def test_get_model_returns_registered_if_exists(self, monkeypatch, model_registry, model_schema): factory = ModelFactory(model_schema) model = factory.make() assert model_registry.is_registered(model_schema.model_name) # prevent future calls to `make` and assume model is current monkeypatch.setattr(factory, 'make', lambda: None) monkeypatch.setattr(model_schema, 'is_current_model', lambda x: True) assert factory.get_model() == model
def test_destroy_model_disconnects_signal(self, model_schema): factory = ModelFactory(model_schema) model = factory.make() assert self.schema_checker_is_connected(model) factory.destroy() assert not self.schema_checker_is_connected(model)
def test_destroy_model_unregisters(self, model_registry, model_schema): factory = ModelFactory(model_schema) factory.make() assert model_registry.is_registered(model_schema.model_name) factory.destroy() assert not model_registry.is_registered(model_schema.model_name)