From a396b3c9cec586061905376ed20060112fe99f45 Mon Sep 17 00:00:00 2001 From: Maja Massarini Date: Thu, 24 Aug 2023 12:05:51 +0200 Subject: [PATCH] Get the build id from the event. The SRPMBuildModel, unlike the CoprBuildModel, has not a build id associated. Take the build id from the event. --- packit_service/worker/checker/copr.py | 2 +- tests/unit/test_checkers.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packit_service/worker/checker/copr.py b/packit_service/worker/checker/copr.py index 245233ee7..4a2d34f27 100644 --- a/packit_service/worker/checker/copr.py +++ b/packit_service/worker/checker/copr.py @@ -87,7 +87,7 @@ def pre_check(self) -> bool: return True logger.debug( - f"The Copr build {self.build.build_id} (pkg={build_for_package}) " + f"The Copr build {self.copr_event.build_id} (pkg={build_for_package}) " f"does not match the package from the configuration " f"({self.job_config.package})." ) diff --git a/tests/unit/test_checkers.py b/tests/unit/test_checkers.py index 388f0fb3f..61c5a1590 100644 --- a/tests/unit/test_checkers.py +++ b/tests/unit/test_checkers.py @@ -35,6 +35,7 @@ ) from packit_service.worker.events import ( PullRequestGithubEvent, + AbstractCoprBuildEvent, ) from packit_service.worker.events.event import EventData from packit_service.worker.events.github import ( @@ -363,13 +364,17 @@ def test_copr_build_is_package_matching_job_view(): ) ] + flexmock(AbstractCoprBuildEvent).should_receive("from_event_dict").and_return( + flexmock(build_id=123) + ) + checker = IsPackageMatchingJobView( flexmock(), jobs[0], {"pkg": "package"}, ) checker._build = ( - flexmock(build_id=123) + flexmock() .should_receive("get_package_name") .and_return("package-b") .once()