models: Change text representation for realm emoji.

This commit changes the textual representation for realm emoji to
give more info.
This commit is contained in:
Harshit Bansal 2017-12-15 16:12:10 +00:00 committed by Tim Abbott
parent e3c09e0308
commit 52e5b78613
2 changed files with 7 additions and 2 deletions

View File

@ -399,7 +399,11 @@ class RealmEmoji(models.Model):
unique_together = ("realm", "name")
def __str__(self) -> Text:
return "<RealmEmoji(%s): %s %s>" % (self.realm.string_id, self.name, self.file_name)
return "<RealmEmoji(%s): %s %s %s %s>" % (self.realm.string_id,
self.id,
self.name,
self.deactivated,
self.file_name)
def get_realm_emoji_uncached(realm: Realm) -> Dict[Text, Dict[str, Any]]:
d = {}

View File

@ -61,9 +61,10 @@ class RealmEmojiTest(ZulipTestCase):
content["emoji"]['my_emoji']['author']['email'], email)
realm_emoji = RealmEmoji.objects.get(name='my_emoji')
file_name = realm_emoji.name + '.png'
self.assertEqual(
str(realm_emoji),
'<RealmEmoji(zulip): my_emoji my_emoji.png>'
'<RealmEmoji(zulip): %s my_emoji False %s>' % (realm_emoji.id, file_name)
)
def test_upload_exception(self) -> None: