def test_multiple_creators(self): """No crash if multiple creators in history table""" log_action(self.request, self.obj, ADDITION) user2 = User.objects.create_superuser('test2', '*****@*****.**', 'booh2') self.request.user = user2 log_action(self.request, self.obj, ADDITION) self.assertEqual(self.obj.creator, user2)
def test_creator(self): log_action(self.request, self.obj, ADDITION) self.assertEqual(self.obj.creator, self.user)
def test_not_authenticated(self): self.request.user = AnonymousUser() log_action(self.request, self.obj, ADDITION) self.assertIsNone(self.obj.creator)
def test_action_history_not_enabled(self): app_settings["ACTION_HISTORY_ENABLED"] = False log_action(self.request, self.obj, ADDITION) self.assertIsNone(self.obj.creator) app_settings["ACTION_HISTORY_ENABLED"] = True