Skip to content

Commit

Permalink
messages: Fix wrong update attribution in ready for testing message s…
Browse files Browse the repository at this point in the history
…tring

Signed-off-by: Mattia Verga <[email protected]>
(cherry picked from commit a01c5ef)
  • Loading branch information
mattiaverga committed Jul 30, 2023
1 parent e079809 commit 262fa9f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions bodhi-messages/bodhi/messages/schemas/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']])} ")
4 changes: 2 additions & 2 deletions bodhi-messages/tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions news/5415.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed wrong update attribution in ready for testing message string

0 comments on commit 262fa9f

Please sign in to comment.