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
def update_last_modified(self): cache.update_last_modified(self.model_schema.initial_model_name)
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
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)