def test_get_model_returns_registered_if_exists( self, monkeypatch, model_registry, model_schema ): factory = ModelFactory(model_schema) model = factory.make_model() assert model_registry.is_registered(model_schema.model_name) assert factory.get_model() is model
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