Skip to content

Commit

Permalink
re-add mock_engine to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cl0ete committed Oct 11, 2024
1 parent 0b7172d commit df1cbbd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions trustregistry/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ def test_create_app():


@pytest.mark.anyio
@patch("trustregistry.main.engine")
@patch("trustregistry.main.check_migrations")
@patch("trustregistry.main.Config")
@patch("trustregistry.main.command")
@patch("trustregistry.main.logger")
async def test_lifespan_migrations_needed(
mock_logger, mock_command, mock_config, mock_check_migrations
mock_logger, mock_command, mock_config, mock_check_migrations, mock_engine
):
mock_check_migrations.return_value = False
mock_config.return_value = MagicMock()
Expand All @@ -45,12 +46,13 @@ async def test_lifespan_migrations_needed(


@pytest.mark.anyio
@patch("trustregistry.main.engine")
@patch("trustregistry.main.check_migrations")
@patch("trustregistry.main.Config")
@patch("trustregistry.main.command")
@patch("trustregistry.main.logger")
async def test_lifespan_already_exists_error(
mock_logger, mock_command, mock_config, mock_check_migrations
mock_logger, mock_command, mock_config, mock_check_migrations, mock_engine
):
mock_check_migrations.return_value = False
mock_config.return_value = MagicMock()
Expand All @@ -71,12 +73,13 @@ async def test_lifespan_already_exists_error(


@pytest.mark.anyio
@patch("trustregistry.main.engine")
@patch("trustregistry.main.check_migrations")
@patch("trustregistry.main.Config")
@patch("trustregistry.main.command")
@patch("trustregistry.main.logger")
async def test_lifespan_unexpected_error(
mock_logger, mock_command, mock_config, mock_check_migrations
mock_logger, mock_command, mock_config, mock_check_migrations, mock_engine
):
mock_check_migrations.return_value = False
mock_config.return_value = MagicMock()
Expand All @@ -90,9 +93,12 @@ async def test_lifespan_unexpected_error(


@pytest.mark.anyio
@patch("trustregistry.main.engine")
@patch("trustregistry.main.check_migrations")
@patch("trustregistry.main.logger")
async def test_lifespan_no_migrations_needed(mock_logger, mock_check_migrations):
async def test_lifespan_no_migrations_needed(
mock_logger, mock_check_migrations, mock_engine
):
mock_check_migrations.return_value = True

async with lifespan(FastAPI()):
Expand Down

0 comments on commit df1cbbd

Please sign in to comment.