'Tests that update_if_dirty works.
We use the last_modified field as a proxy for knowing
whether or not we actually did a save.'

def test_update_if_dirty(self):

    create_tables(TestModel)
    x = TestModel()
    x.my_int = 3
    x.my_string = 'foo'
    x.save()
    last_mod = x.last_modified
    django_util.update_if_dirty(x, my_int=3, my_string='bar')
    assert_not_equal(x.last_modified, last_mod)
    last_mod = x.last_modified
    django_util.update_if_dirty(x, my_int=3, my_string='bar')
    assert_equal(x.last_modified, last_mod)
    x.delete()
