def mock_db(fake_db): local_alchemy, _ = create_initial_mock_database() def constructor(): return local_alchemy class Mocker: def __init__(self, starter_instance): self.mock_db = starter_instance def create_mock_db_instance(self, existing_data=None): self.mock_db, _ = create_initial_mock_database(existing_data=existing_data) def apply_mock(self): from backend.database.startup import EngineStartup EngineStartup.startup(replacement=constructor) return Mocker(local_alchemy)
def create_mock_db_instance(self, existing_data=None): self.mock_db, _ = create_initial_mock_database(existing_data=existing_data)