def METHOD_NAME(
    postgresql: engine.Engine, monkeypatch: pytest.MonkeyPatch
) -> orm.Session:
    session_local = orm.sessionmaker(
        autocommit=False, autoflush=False, bind=postgresql
    )
    monkeypatch.setattr(database, "engine", postgresql)
    monkeypatch.setattr(database, "SessionLocal", session_local)
    delete_all_tables_if_existent(postgresql)
    migration.migrate_db(
        postgresql, str(postgresql.url).replace("***", "test")
    )
    with session_local() as session:
        def mock_get_db() -> orm.Session:
            return session
        app.dependency_overrides[database.get_db] = mock_get_db
        yield session