forked from sr2/cloud-api
minor: rename test client
client -> default_client To allow for different clients. Primarily to allow different overrides for auth testing.
This commit is contained in:
parent
a907506ec1
commit
9d9ca0b907
7 changed files with 140 additions and 140 deletions
|
|
@ -4,12 +4,12 @@
|
|||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
from .conftest import client
|
||||
from .conftest import default_client
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_services_success(client: AsyncClient):
|
||||
resp = await client.get("/service/?org_id=1")
|
||||
async def test_get_services_success(default_client: AsyncClient):
|
||||
resp = await default_client.get("/service/?org_id=1")
|
||||
data = resp.json()
|
||||
|
||||
assert resp.status_code == 200
|
||||
|
|
@ -28,15 +28,15 @@ async def test_get_services_success(client: AsyncClient):
|
|||
],
|
||||
)
|
||||
@pytest.mark.anyio
|
||||
async def test_get_services_failure(client: AsyncClient, query: str, expected_status: int):
|
||||
resp = await client.get(f"/service/?{query}")
|
||||
async def test_get_services_failure(default_client: AsyncClient, query: str, expected_status: int):
|
||||
resp = await default_client.get(f"/service/?{query}")
|
||||
|
||||
assert resp.status_code == expected_status
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_post_service_success(client: AsyncClient):
|
||||
resp = await client.post("/service/", json={"name": "New Test Service"})
|
||||
async def test_post_service_success(default_client: AsyncClient):
|
||||
resp = await default_client.post("/service/", json={"name": "New Test Service"})
|
||||
data = resp.json()
|
||||
|
||||
assert resp.status_code == 200
|
||||
|
|
@ -55,15 +55,15 @@ async def test_post_service_success(client: AsyncClient):
|
|||
],
|
||||
)
|
||||
@pytest.mark.anyio
|
||||
async def test_post_services_failure(client: AsyncClient, body: dict[str, str], expected_status: int):
|
||||
resp = await client.post("/service/", json=body)
|
||||
async def test_post_services_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int):
|
||||
resp = await default_client.post("/service/", json=body)
|
||||
|
||||
assert resp.status_code == expected_status
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_patch_service_success(client: AsyncClient):
|
||||
resp = await client.patch("/service/key", json={"service_id": 1})
|
||||
async def test_patch_service_success(default_client: AsyncClient):
|
||||
resp = await default_client.patch("/service/key", json={"service_id": 1})
|
||||
data = resp.json()
|
||||
|
||||
assert resp.status_code == 200
|
||||
|
|
@ -84,7 +84,7 @@ async def test_patch_service_success(client: AsyncClient):
|
|||
],
|
||||
)
|
||||
@pytest.mark.anyio
|
||||
async def test_patch_services_failure(client: AsyncClient, body: dict[str, str], expected_status: int):
|
||||
resp = await client.patch("/service/key", json=body)
|
||||
async def test_patch_services_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int):
|
||||
resp = await default_client.patch("/service/key", json=body)
|
||||
|
||||
assert resp.status_code == expected_status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue