diff --git a/test/test_iam.py b/test/test_iam.py index fa52a0b..de505f1 100644 --- a/test/test_iam.py +++ b/test/test_iam.py @@ -1,5 +1,4 @@ """ -Act on resource tests only check for pass/fail on input validation. Logic is not tested. """ import pytest from httpx import AsyncClient @@ -83,7 +82,7 @@ async def test_act_on_resource_missing_key(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_act_on_resource_endpoint_failure(default_client: AsyncClient, service, org, resource, action, +async def test_act_on_resource_endpoint_status_checks(default_client: AsyncClient, service, org, resource, action, expected_status: int): body = { "service": service, @@ -160,7 +159,7 @@ async def test_get_group_permissions_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_group_permissions_failure(default_client: AsyncClient, db_session, query: str, expected_status: int): +async def test_get_group_permissions_status_checks(default_client: AsyncClient, db_session, query: str, expected_status: int): resp = await default_client.get(f"/iam/group/permissions?{query}") assert resp.status_code == expected_status @@ -216,7 +215,7 @@ async def test_get_group_users_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_group_users_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_group_users_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/iam/group/users?{query}") assert resp.status_code == expected_status @@ -269,7 +268,7 @@ async def test_post_group_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_post_group_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_post_group_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.post("/iam/group", json=body) assert resp.status_code == expected_status @@ -327,7 +326,7 @@ async def test_put_group_perm_success(default_client: AsyncClient, db_session): ], ) @pytest.mark.anyio -async def test_put_group_perm_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_put_group_perm_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.put("/iam/group/permission", json=body) assert resp.status_code == expected_status @@ -403,7 +402,7 @@ async def test_put_group_user_success(default_client: AsyncClient, db_session): ], ) @pytest.mark.anyio -async def test_put_group_user_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_put_group_user_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.put("/iam/group/user", json=body) assert resp.status_code == expected_status @@ -433,7 +432,7 @@ async def test_get_permissions_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_permissions_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_permissions_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/iam/permissions?{query}") assert resp.status_code == expected_status @@ -479,7 +478,7 @@ async def test_post_perm_success(default_client: AsyncClient, db_session): ], ) @pytest.mark.anyio -async def test_post_perm_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_post_perm_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.post("/iam/permission", json=body) assert resp.status_code == expected_status @@ -536,7 +535,7 @@ async def test_post_perm_search_success(default_client: AsyncClient, db_session, ], ) @pytest.mark.anyio -async def test_post_perm_search_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_post_perm_search_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.post("/iam/permissions/search", json=body) assert resp.status_code == expected_status diff --git a/test/test_organisation.py b/test/test_organisation.py index bde5df0..3fc6a3c 100644 --- a/test/test_organisation.py +++ b/test/test_organisation.py @@ -32,7 +32,7 @@ async def test_get_org_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_org_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_org_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/org?{query}") assert resp.status_code == expected_status @@ -57,7 +57,7 @@ async def test_post_org_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_post_org_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_post_org_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.post("/org", json=body) assert resp.status_code == expected_status @@ -93,7 +93,7 @@ async def test_patch_org_questionnaire_partial_success(default_client: AsyncClie ], ) @pytest.mark.anyio -async def test_patch_questionnaire_partial_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_patch_questionnaire_partial_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.patch("/org/questionnaire", json=body) assert resp.status_code == expected_status @@ -142,7 +142,7 @@ async def test_patch_org_status_success(default_client: AsyncClient, status: str ], ) @pytest.mark.anyio -async def test_patch_org_status_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_patch_org_status_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.patch("/org/status", json=body) assert resp.status_code == expected_status @@ -173,7 +173,7 @@ async def test_get_org_users_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_org_users_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_org_users_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/org/users?{query}") assert resp.status_code == expected_status @@ -205,7 +205,7 @@ async def test_post_org_user_success(default_client: AsyncClient, db_session): ], ) @pytest.mark.anyio -async def test_post_org_user_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int, db_session): +async def test_post_org_user_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int, db_session): db_session.add(User(email="user@test.org", first_name="User", last_name="Test", oidc_id="abcd-efgh-ijkl-1234")) db_session.flush() @@ -242,7 +242,7 @@ async def test_patch_org_root_user_success(default_client: AsyncClient, db_sessi ], ) @pytest.mark.anyio -async def test_patch_root_user_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int, db_session): +async def test_patch_root_user_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int, db_session): db_session.add(User(email="user@test.org", first_name="User", last_name="Test", oidc_id="abcd-efgh-ijkl-1234")) db_session.flush() db_session.add(OrgUsers(org_id=1, user_id=2)) @@ -285,7 +285,7 @@ async def test_get_org_groups_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_org_groups_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_org_groups_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/org/groups?{query}") assert resp.status_code == expected_status @@ -339,7 +339,7 @@ async def test_get_org_contact_success(default_client: AsyncClient, contact_type ], ) @pytest.mark.anyio -async def test_get_org_contact_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_org_contact_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/org/contact?{query}") assert resp.status_code == expected_status @@ -391,7 +391,7 @@ async def test_patch_org_contact_success(default_client: AsyncClient, key: str, ], ) @pytest.mark.anyio -async def test_patch_org_status_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_patch_org_status_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.patch("/org/contact", json=body) assert resp.status_code == expected_status diff --git a/test/test_service.py b/test/test_service.py index ede39a8..b98095b 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -27,7 +27,7 @@ async def test_get_services_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_get_services_failure(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_services_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/service/?{query}") assert resp.status_code == expected_status @@ -53,7 +53,7 @@ async def test_post_service_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_post_services_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_post_services_status_checks(default_client: AsyncClient, body: dict[str, str], expected_status: int): resp = await default_client.post("/service/", json=body) assert resp.status_code == expected_status @@ -81,7 +81,7 @@ async def test_patch_service_success(default_client: AsyncClient): ], ) @pytest.mark.anyio -async def test_patch_services_failure(default_client: AsyncClient, body: dict[str, str], expected_status: int): +async def test_patch_services_status_checks(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 diff --git a/test/test_user.py b/test/test_user.py index bda6912..f8ad0d1 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -9,7 +9,7 @@ from httpx import AsyncClient from .conftest import default_client @pytest.mark.anyio -async def test_get_self_db(default_client: AsyncClient): +async def test_get_self_db_success(default_client: AsyncClient): resp = await default_client.get("/user/self/db") data = resp.json() @@ -44,7 +44,7 @@ async def test_get_user_success(default_client: AsyncClient): ("", 422), ], ) -async def test_get_user_fail(default_client: AsyncClient, query: str, expected_status: int): +async def test_get_user_status_checks(default_client: AsyncClient, query: str, expected_status: int): resp = await default_client.get(f"/user/?{query}") assert resp.status_code == expected_status