diff --git a/tahrir_messages/__init__.py b/tahrir_messages/__init__.py index 7f840e9..e87ebaf 100644 --- a/tahrir_messages/__init__.py +++ b/tahrir_messages/__init__.py @@ -76,6 +76,9 @@ def agent_name(self): def summary(self): return f"{self.agent_name} was awarded the badge `{self.body['badge']['name']}`" + def __str__(self): + return self.body["badge"]['description'] + badge_schema: typing.ClassVar = { "type": "object", "required": ["badge_id", "description", "image_url", "name"], @@ -91,7 +94,7 @@ def summary(self): body_schema: typing.ClassVar = { "id": "http://fedoraproject.org/message-schema/tahrir", "$schema": "http://json-schema.org/draft-04/schema#", - "description": "The message sent when a user logs into tahrir for the first time", + "description": "The message sent when a badge is awarded", "type": "object", "required": ["user", "badge"], "properties": { diff --git a/tests/test_messages.py b/tests/test_messages.py index 89cefa6..3ddd829 100644 --- a/tests/test_messages.py +++ b/tests/test_messages.py @@ -44,7 +44,7 @@ def test_badge_award(): expected_summary = "dudemcpants was awarded the badge `White Hat`" assert message.topic == "badges.badge.award" assert message.summary == expected_summary - assert str(message) == expected_summary + assert str(message) == DUMMY_BADGE["description"] assert message.agent_name == "dudemcpants" assert message.usernames == ["dudemcpants"] assert message.app_name == "tahrir"