diff --git a/bodhi-messages/bodhi/messages/schemas/update.py b/bodhi-messages/bodhi/messages/schemas/update.py index e56b6633b5..35f646f5ca 100644 --- a/bodhi-messages/bodhi/messages/schemas/update.py +++ b/bodhi-messages/bodhi/messages/schemas/update.py @@ -989,3 +989,35 @@ class UpdateReadyForTestingV2(UpdateReadyForTestingV1): body_schema['definitions']['build'] = BuildV1.schema() body_schema['properties']['update'] = UpdateV1.schema() body_schema['required'].append('update') + + @property + def summary(self) -> str: + """ + Return a short, human-readable representation of this message. + + This should provide a short summary of the message, much like the subject line + of an email. + + Returns: + A summary for this message. + """ + return ( + f"{self.body['update']['user']['name']}'s " + f"{truncate(' '.join([b['nvr'] for b in self.body['artifact']['builds']]))} " + f"bodhi update is ready for testing") + + def __str__(self) -> str: + """ + Return a human-readable representation of this message. + + This should provide a detailed representation of the message, much like the body + of an email. + + Returns: + A human readable representation of this message. + """ + new_line = "\n" + return ( + f"{self.body['update']['user']['name']}'s Bodhi update is ready for testing\n" + f"Builds:\n" + f"{new_line.join([b['nvr'] for b in self.body['artifact']['builds']])} ") diff --git a/bodhi-messages/tests/test_update.py b/bodhi-messages/tests/test_update.py index d000a0fb23..1363f8b2fe 100644 --- a/bodhi-messages/tests/test_update.py +++ b/bodhi-messages/tests/test_update.py @@ -248,11 +248,11 @@ def test_ready_for_testing_v2(self): expected = { "topic": "bodhi.update.status.testing.koji-build-group.build.complete", "summary": ( - "BaseOS CI's libselinux-2.8-6.fc29.x86_64 libsepol-2.… bodhi update " + "plautrba's libselinux-2.8-6.fc29.x86_64 libsepol-2.… bodhi update " "is ready for testing" ), "__str__": ( - "BaseOS CI's Bodhi update is ready for testing\nBuilds:" + "plautrba's Bodhi update is ready for testing\nBuilds:" "\nlibselinux-2.8-6.fc29.x86_64\nlibsepol-2.8-3.fc29.x86_64 " ), "app_icon": "https://apps.fedoraproject.org/img/icons/bodhi.png", diff --git a/news/5415.bug b/news/5415.bug new file mode 100644 index 0000000000..a018c3d027 --- /dev/null +++ b/news/5415.bug @@ -0,0 +1 @@ +Fixed wrong update attribution in ready for testing message string