Skip to content

Commit

Permalink
Fix getting project_url for AnityaProjectModel projects (#2501)
Browse files Browse the repository at this point in the history
Fix getting project_url for AnityaProjectModel projects

Related to #2203
RELEASE NOTES BEGIN
N/A
RELEASE NOTES END

Reviewed-by: Nikola Forró
  • Loading branch information
softwarefactory-project-zuul[bot] authored Aug 14, 2024
2 parents 9a79d53 + faa6425 commit eb20ac7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packit_service/worker/events/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CoprBuildTargetModel,
TFTTestRunTargetModel,
filter_most_recent_target_names_by_status,
AnityaProjectModel,
)

logger = getLogger(__name__)
Expand Down Expand Up @@ -378,7 +379,10 @@ def get_dict(self, default_dict: Optional[Dict] = None) -> dict:
)
d["project_url"] = d.get("project_url") or (
self.db_project_object.project.project_url
if self.db_project_object
if (
self.db_project_object
and not isinstance(self.db_project_object.project, AnityaProjectModel)
)
else None
)
if self.build_targets_override:
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/test_new_hotness_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
SyncReleaseJobType,
SyncReleasePullRequestModel,
AnityaVersionModel,
AnityaProjectModel,
)
from packit_service.service.db_project_events import AddReleaseEventToDb
from packit_service.worker.allowlist import Allowlist
Expand Down Expand Up @@ -80,11 +81,14 @@ def sync_release_model():

@pytest.fixture
def sync_release_model_non_git():
class AnityaTestProjectModel(AnityaProjectModel):
pass

db_project_object = flexmock(
id=12,
project_event_model_type=ProjectEventModelType.release,
job_config_trigger_type=JobConfigTriggerType.release,
project=flexmock(project_url=None),
project=AnityaTestProjectModel(),
)
project_event = (
flexmock()
Expand Down

0 comments on commit eb20ac7

Please sign in to comment.