예제 #1
0
 def test_name_hasnt_changed_after_save(self):
     inst = Organization(id=1, name="bar")
     update_tracked_data(inst)
     inst.name = "baz"
     self.assertTrue(has_changed(inst, "name"))
     self.assertEqual(old_value(inst, "name"), "bar")
     update_tracked_data(inst)
     models.signals.post_save.send(instance=inst, sender=type(inst), created=False)
     self.assertFalse(has_changed(inst, "name"))
예제 #2
0
 def test_name_has_changes_before_save(self):
     inst = Organization(id=1, name="bar")
     update_tracked_data(inst)
     inst.name = "baz"
     self.assertTrue(has_changed(inst, "name"))
     self.assertEquals(old_value(inst, "name"), "bar")