def test_delete_last_modified(mock_now):
    cache.update_last_modified(TEST_MODEL_NAME)
    assert cache.get_last_modified(TEST_MODEL_NAME) == now
    cache.clear_last_modified(TEST_MODEL_NAME)
    assert cache.get_last_modified(TEST_MODEL_NAME) is None
def test_get_and_update_last_modified(mock_now):
    assert cache.get_last_modified(TEST_MODEL_NAME) is None
    cache.update_last_modified(TEST_MODEL_NAME)
    assert cache.get_last_modified(TEST_MODEL_NAME) == now
Exemple #3
0
 def update_last_modified(self):
     cache.update_last_modified(self.model_schema.initial_model_name)
Exemple #4
0
 def save(self, **kwargs):
     super().save(**kwargs)
     cache.update_last_modified(self.model_name)
     cache.update_last_modified(self.initial_model_name)
     self._schema_editor.update_table(self._factory.make_model())
     self._initial_name = self.name
Exemple #5
0
 def test_is_current_model(self, model_schema):
     model = model_schema.as_model()
     assert utils.is_current_model(model)
     cache.update_last_modified(model_schema.model_name)
     assert not utils.is_current_model(model)