def test_current_user_field(self): user = User.objects.get(username="******") EchelonMiddleware.set_user(user) TestModel.objects.create(name="TEST") EchelonMiddleware.del_user() test_instance = TestModel.objects.get(name="TEST") self.assertEqual(test_instance.creator, user)
def test_current_user_field_with_no_active_user(self): EchelonMiddleware.del_user() TestModel.objects.create(name="TEST") test_instance = TestModel.objects.get(name="TEST") self.assertEqual(test_instance.creator, None)