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)
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)
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)
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)
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)
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)
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)