Пример #1
0
 def test_ignore_models_created_field(self, get_user):
     """blog.Entry: setting author on nonexistent field doesn't do anything"""
     user = User.objects.create()
     get_user.return_value = user
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, None)
     self.assertEqual(instance.updated_by, None)
Пример #2
0
 def test_callback(self, get_user):
     """blog.Entry: callbacks runned """
     user = User.objects.create()
     get_user.return_value = user
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, user)
     self.assertEqual(instance.updated_by, user)
Пример #3
0
 def test_callback(self, get_user):
     """blog.Entry: callbacks runned """
     user = User.objects.create()
     get_user.return_value = user
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, user)
     self.assertEqual(instance.updated_by, user)
Пример #4
0
 def test_callback_no_user(self):
     """blog.Entry: setting author is ignored"""
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, None)
     self.assertEqual(instance.updated_by, None)
Пример #5
0
 def test_callback_no_user(self):
     """blog.Entry: setting author is ignored"""
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, None)
     self.assertEqual(instance.updated_by, None)
Пример #6
0
 def test_ignore_models_created_field(self):
     """blog.Entry: setting author on nonexistent field doesn't do anything"""
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, None)
     self.assertEqual(instance.updated_by, None)
Пример #7
0
 def test_ignore_models(self):
     """blog.Entry: setting author on ignored models doesn't do anything"""
     instance = models.Entry.objects.create()
     recivers.pre_save_callback(None, instance)
     self.assertEqual(instance.author, None)
     self.assertEqual(instance.updated_by, None)