diff options
| author | 2019-10-11 22:32:46 +0100 | |
|---|---|---|
| committer | 2019-10-11 22:32:46 +0100 | |
| commit | 689a5d9c41395a7da644b25c1e3eab95c2614604 (patch) | |
| tree | b535dc93dbf84e076f663a29cd9c44abdada61d4 /pydis_site/apps/api/tests | |
| parent | Signals: Handle (and test) mapping updates/deletions (diff) | |
| parent | Merge pull request #281 from python-discord/simple-admin-log-entry-view (diff) | |
Merge branch 'master' into #201-django-allauth
Diffstat (limited to 'pydis_site/apps/api/tests')
| -rw-r--r-- | pydis_site/apps/api/tests/test_models.py | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index 2120b056..bce76942 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -1,13 +1,21 @@ -from datetime import datetime as dt, timezone +from datetime import datetime as dt from django.test import SimpleTestCase +from django.utils import timezone from ..models import ( - DeletedMessage, DocumentationLink, - Infraction, Message, - MessageDeletionContext, ModelReprMixin, - OffTopicChannelName, Reminder, - Role, Tag, User + DeletedMessage, + DocumentationLink, + Infraction, + Message, + MessageDeletionContext, + ModelReprMixin, + Nomination, + OffTopicChannelName, + Reminder, + Role, + Tag, + User ) @@ -27,6 +35,19 @@ class ReprMixinTests(SimpleTestCase): class StringDunderMethodTests(SimpleTestCase): def setUp(self): + self.nomination = Nomination( + id=123, + actor=User( + id=9876, name='Mr. Hemlock', + discriminator=6666, avatar_hash=None + ), + user=User( + id=9876, name="Hemlock's Cat", + discriminator=7777, avatar_hash=None + ), + reason="He purrrrs like the best!", + ) + self.objects = ( DeletedMessage( id=45, @@ -102,3 +123,9 @@ class StringDunderMethodTests(SimpleTestCase): def test_returns_string(self): for instance in self.objects: self.assertIsInstance(str(instance), str) + + def test_nomination_str_representation(self): + self.assertEqual( + "Nomination of Hemlock's Cat#7777 (active)", + str(self.nomination) + ) |