exactly one called with instead of last call check

This commit is contained in:
2021-10-14 03:12:45 +03:00
parent fcb167b1a3
commit 4502931c39
24 changed files with 83 additions and 78 deletions

View File

@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"]})
assert response.ok
add_mock.assert_called_with(["ahriman"], now=True)
add_mock.assert_called_once_with(["ahriman"], now=True)
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
@ -46,4 +46,4 @@ async def test_post_update(client: TestClient, mocker: MockerFixture) -> None:
response = await client.post("/service-api/v1/update", json={"packages": ["ahriman"]})
assert response.ok
add_mock.assert_called_with(["ahriman"], now=True)
add_mock.assert_called_once_with(["ahriman"], now=True)

View File

@ -27,7 +27,7 @@ async def test_post(client_with_auth: TestClient, mocker: MockerFixture) -> None
assert response.ok
reload_mock.assert_called_once()
load_mock.assert_called_with(client_with_auth.app["configuration"])
load_mock.assert_called_once_with(client_with_auth.app["configuration"])
async def test_post_no_auth(client: TestClient, mocker: MockerFixture) -> None:

View File

@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
response = await client.post("/service-api/v1/remove", json={"packages": ["ahriman"]})
assert response.ok
remove_mock.assert_called_with(["ahriman"])
remove_mock.assert_called_once_with(["ahriman"])
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:

View File

@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
response = await client.post("/service-api/v1/request", json={"packages": ["ahriman"]})
assert response.ok
add_mock.assert_called_with(["ahriman"], now=False)
add_mock.assert_called_once_with(["ahriman"], now=False)
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:

View File

@ -48,7 +48,7 @@ async def test_get_join(client: TestClient, mocker: MockerFixture) -> None:
response = await client.get("/service-api/v1/search", params=[("for", "ahriman"), ("for", "maybe")])
assert response.ok
search_mock.assert_called_with("ahriman maybe")
search_mock.assert_called_once_with("ahriman maybe")
async def test_get_join_filter(client: TestClient, mocker: MockerFixture) -> None:
@ -59,7 +59,7 @@ async def test_get_join_filter(client: TestClient, mocker: MockerFixture) -> Non
response = await client.get("/service-api/v1/search", params=[("for", "ah"), ("for", "maybe")])
assert response.ok
search_mock.assert_called_with("maybe")
search_mock.assert_called_once_with("maybe")
async def test_get_join_filter_empty(client: TestClient, mocker: MockerFixture) -> None: