Stop handling an impossible case

We check eliminate the case with zero log entries when checking that
obj.history.count() is exactly 1.
This commit is contained in:
Alieh Rymašeŭski 2020-10-05 13:22:22 +03:00
parent 2b44eebd50
commit f647966210

View file

@ -44,17 +44,12 @@ class SimpleModelTest(TestCase):
# Check for log entries
self.assertEqual(obj.history.count(), 1, msg="There is one log entry")
try:
history = obj.history.get()
except obj.history.DoesNotExist:
self.assertTrue(False, "Log entry exists")
else:
self.assertEqual(
history.action, LogEntry.Action.CREATE, msg="Action is 'CREATE'"
)
self.assertEqual(
history.object_repr, str(obj), msg="Representation is equal"
)
history = obj.history.get()
self.assertEqual(
history.action, LogEntry.Action.CREATE, msg="Action is 'CREATE'"
)
self.assertEqual(history.object_repr, str(obj), msg="Representation is equal")
def test_update(self):
"""Updates are logged correctly."""