예제 #1
0
 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)
예제 #2
0
파일: tests.py 프로젝트: yanjunjie/python
 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)
예제 #3
0
 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)
예제 #4
0
파일: tests.py 프로젝트: yanjunjie/python
 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)