File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed
Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 11import os
2+ import time
23from importlib import reload
34from typing import Generator , Any , MutableMapping
45
1011from testcontainers .core .container import DockerContainer
1112
1213import app .config as config
13- import app .db_schema_migrations .yoyo_migration as yoyo_migration
1414import app .db .database_config as database_config
15+ import app .db_schema_migrations .yoyo_migration as yoyo_migration
1516import app .main as main
16- import time
1717
1818
1919@pytest .fixture (scope = "session" )
Original file line number Diff line number Diff line change 1+ import pytest
2+ from assertpy import assert_that
3+ from fastapi import Response
4+ from fastapi .testclient import TestClient
5+ from importlib import reload
6+ import app .routers .customer as customer
7+
8+
9+ @pytest .fixture
10+ def reload_customer_router () -> None :
11+ reload (customer )
12+ return None
13+
14+
15+ def test_customers_insert_read_delete (
16+ test_client : TestClient ,
17+ reload_customer_router : None ,
18+ ):
19+ initial_delete : Response = test_client .delete ("/context/customers" )
20+ assert_that (initial_delete .status_code ).is_equal_to (204 )
Original file line number Diff line number Diff line change 1+ from unittest .mock import AsyncMock
2+
3+ import pytest
4+ from assertpy import assert_that
5+ from fastapi import Response
6+ from fastapi .testclient import TestClient
7+ from pytest_mock import MockerFixture
8+
9+
10+ @pytest .fixture
11+ def mock_database_execute (mocker : MockerFixture ) -> AsyncMock :
12+ mock_execute : AsyncMock = mocker .patch ("app.db.database_config.database.execute" )
13+ return mock_execute
14+
15+
16+ def test_customers_insert_read_delete (
17+ mock_database_execute : AsyncMock , test_client : TestClient
18+ ):
19+ initial_delete : Response = test_client .delete ("/context/customers" )
20+ assert_that (initial_delete .status_code ).is_equal_to (204 )
You can’t perform that action at this time.
0 commit comments