aboutsummaryrefslogtreecommitdiffstats
path: root/api/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-09-21 22:43:52 +0200
committerGravatar Johannes Christ <[email protected]>2018-09-21 22:43:52 +0200
commitb0538bd2191b99eac1ee5ae7e95d0875dd71d181 (patch)
treec51994c8a075a28b2ceacc1556b4018f9246b752 /api/tests
parentAdd help texts on all API models. (diff)
Add `__repr__` to all models.
Diffstat (limited to '')
-rw-r--r--api/tests/test_models.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/tests/test_models.py b/api/tests/test_models.py
new file mode 100644
index 00000000..7ed49a78
--- /dev/null
+++ b/api/tests/test_models.py
@@ -0,0 +1,17 @@
+from django.test import SimpleTestCase
+
+from ..models import ModelReprMixin
+
+
+class SimpleClass(ModelReprMixin):
+ def __init__(self, is_what):
+ self.the_cake = is_what
+
+
+class ReprMixinTests(SimpleTestCase):
+ def setUp(self):
+ self.klass = SimpleClass('is a lie')
+
+ def test_shows_attributes(self):
+ expected = "<SimpleClass(the_cake='is a lie')>"
+ self.assertEqual(repr(self.klass), expected)