Skip to content

Commit 42e5d50

Browse files
committed
Fix tests
Signed-off-by: Nikola Forró <nforro@redhat.com> Assisted-by: Claude Opus 4.6 via Claude Code
1 parent 019df52 commit 42e5d50

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def koji_build_pr_downstream():
396396

397397
run_model = flexmock(
398398
id=3,
399-
datetime=datetime.now(),
399+
datetime=datetime.utcnow(),
400400
job_project_event=project_event_model,
401401
srpm_build=srpm_build,
402402
koji_build=koji_build_model,

tests/integration/test_logdetective_koji.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def test_logdetective_koji_build_scratch_downstream(
7777
flexmock(KojiBuildTargetModel).should_receive("get_by_task_id").and_return(
7878
koji_build_pr_downstream
7979
)
80+
flexmock(KojiBuildTargetModel).should_receive("has_newer_run").and_return(False)
8081

8182
koji_build_pr_downstream.should_receive("set_build_start_time").once()
8283
koji_build_pr_downstream.should_receive("set_build_finished_time").once()
@@ -186,6 +187,7 @@ def test_logdetective_skipped_when_project_disabled(
186187
flexmock(KojiBuildTargetModel).should_receive("get_by_task_id").and_return(
187188
koji_build_pr_downstream
188189
)
190+
flexmock(KojiBuildTargetModel).should_receive("has_newer_run").and_return(False)
189191

190192
koji_build_pr_downstream.should_receive("set_build_start_time").once()
191193
koji_build_pr_downstream.should_receive("set_build_finished_time").once()

tests/unit/test_testing_farm.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def test_testing_farm_response(
9595
tests_summary,
9696
status_status,
9797
status_message,
98+
monkeypatch,
9899
):
99100
package_config = flexmock(
100101
jobs=[
@@ -180,7 +181,7 @@ def test_testing_farm_response(
180181
update_feedback_time=object,
181182
).once()
182183

183-
urls.DASHBOARD_URL = "https://dashboard.localhost"
184+
monkeypatch.setattr(urls, "DASHBOARD_URL", "https://dashboard.localhost")
184185
tft_test_run_model = (
185186
flexmock(
186187
id=123,
@@ -225,7 +226,7 @@ def test_testing_farm_response(
225226
test_farm_handler.run()
226227

227228

228-
def test_testing_farm_response_skips_reporting_for_superseded_run():
229+
def test_testing_farm_response_skips_reporting_for_superseded_run(monkeypatch):
229230
package_config = flexmock(
230231
jobs=[
231232
JobConfig(
@@ -302,7 +303,7 @@ def test_testing_farm_response_skips_reporting_for_superseded_run():
302303
)
303304
flexmock(StatusReporter).should_receive("report").never()
304305

305-
urls.DASHBOARD_URL = "https://dashboard.localhost"
306+
monkeypatch.setattr(urls, "DASHBOARD_URL", "https://dashboard.localhost")
306307
tft_test_run_model = (
307308
flexmock(
308309
id=123,
@@ -385,6 +386,7 @@ def test_downstream_testing_farm_response(
385386
tests_summary,
386387
status_status,
387388
status_message,
389+
monkeypatch,
388390
):
389391
config = flexmock(
390392
command_handler_work_dir=flexmock(),
@@ -430,7 +432,7 @@ def test_downstream_testing_farm_response(
430432
target_branch="rawhide",
431433
).once()
432434

433-
urls.DASHBOARD_URL = "https://dashboard.localhost"
435+
monkeypatch.setattr(urls, "DASHBOARD_URL", "https://dashboard.localhost")
434436
tft_test_run_model = (
435437
flexmock(
436438
id=123,
@@ -1637,7 +1639,8 @@ def test_get_request_details():
16371639
),
16381640
],
16391641
)
1640-
def test_trigger_build(copr_build, wait_for_build):
1642+
def test_trigger_build(copr_build, wait_for_build, monkeypatch):
1643+
monkeypatch.setattr(urls, "DASHBOARD_URL", "https://dashboard.localhost")
16411644
valid_commit_sha = "1111111111111111111111111111111111111111"
16421645

16431646
package_config = PackageConfig(packages={"package": CommonPackageConfig()})
@@ -1719,7 +1722,8 @@ def test_trigger_build(copr_build, wait_for_build):
17191722
tf_handler.run()
17201723

17211724

1722-
def test_trigger_build_manual_tests_dont_report():
1725+
def test_trigger_build_manual_tests_dont_report(monkeypatch):
1726+
monkeypatch.setattr(urls, "DASHBOARD_URL", "https://dashboard.localhost")
17231727
copr_build = flexmock(
17241728
id=1,
17251729
commit_sha="1111111111111111111111111111111111111111",

0 commit comments

Comments
 (0)