Improve sources and runs history tables
This commit is contained in:
parent
df68aa95e9
commit
939cd9ea5d
7 changed files with 459 additions and 25 deletions
|
|
@ -254,3 +254,51 @@ def test_load_runs_view_running_row_targets_queued_follow_up_cancel(
|
|||
assert running_row["cancel_post_path"] == (
|
||||
f"/actions/queued-executions/{int(pending_execution.get_id())}/cancel"
|
||||
)
|
||||
|
||||
|
||||
def test_load_runs_view_paginates_completed_executions_after_20_rows(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
initialize_database(tmp_path / "jobs-completed-pagination.db")
|
||||
source = create_source(
|
||||
name="Completed source",
|
||||
slug="completed-source",
|
||||
source_type="feed",
|
||||
notes="",
|
||||
spider_arguments="",
|
||||
enabled=False,
|
||||
cron_minute="*/5",
|
||||
cron_hour="*",
|
||||
cron_day_of_month="*",
|
||||
cron_day_of_week="*",
|
||||
cron_month="*",
|
||||
feed_url="https://example.com/completed.xml",
|
||||
)
|
||||
job = Job.get(Job.source == source)
|
||||
base_time = datetime(2026, 3, 30, 12, 0, tzinfo=UTC)
|
||||
for offset in range(21):
|
||||
JobExecution.create(
|
||||
job=job,
|
||||
running_status=JobExecutionStatus.SUCCEEDED,
|
||||
ended_at=base_time - timedelta(minutes=offset),
|
||||
)
|
||||
|
||||
first_page = load_runs_view(
|
||||
log_dir=tmp_path / "out" / "logs",
|
||||
now=base_time,
|
||||
completed_page=1,
|
||||
)
|
||||
second_page = load_runs_view(
|
||||
log_dir=tmp_path / "out" / "logs",
|
||||
now=base_time,
|
||||
completed_page=2,
|
||||
)
|
||||
|
||||
assert len(first_page["completed"]) == 20
|
||||
assert len(second_page["completed"]) == 1
|
||||
assert first_page["completed_page"] == 1
|
||||
assert second_page["completed_page"] == 2
|
||||
assert first_page["completed_total_pages"] == 2
|
||||
assert second_page["completed_total_pages"] == 2
|
||||
assert first_page["completed_total_count"] == 21
|
||||
assert second_page["completed_total_count"] == 21
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue