diff --git a/test/pytest.toml b/test/pytest.toml new file mode 100644 index 0000000..4b2b03b --- /dev/null +++ b/test/pytest.toml @@ -0,0 +1,12 @@ +[tool.pytest] +markers = [ + "iam_module", + "org_module", + "service_module", + "user_module", + "auth", + "root_user", + "super_admin", + "user", + "preapproval" +] \ No newline at end of file diff --git a/test/test_auth_approval.py b/test/test_auth_approval.py index 69c8a25..8bc73d9 100644 --- a/test/test_auth_approval.py +++ b/test/test_auth_approval.py @@ -12,6 +12,12 @@ from src.user.models import User from src.iam.models import Group +pytestmark = [ + pytest.mark.auth, + pytest.mark.preapproval, +] + + @pytest.fixture(autouse=True) def set_org_partial(db_session): org_model = db_session.get(Org, 1) diff --git a/test/test_auth_general.py b/test/test_auth_general.py index 0547824..7ee2070 100644 --- a/test/test_auth_general.py +++ b/test/test_auth_general.py @@ -7,6 +7,11 @@ from src.organisation.models import Organisation as Org from src.user.models import User +pytestmark = [ + pytest.mark.auth, +] + + @pytest.mark.anyio async def test_get_org_auth_root_su(default_client: AsyncClient, db_session): # If a super admin can access a resource when not the root user diff --git a/test/test_auth_root.py b/test/test_auth_root.py index e068a55..c53b42c 100644 --- a/test/test_auth_root.py +++ b/test/test_auth_root.py @@ -11,6 +11,12 @@ from src.user.models import User from src.iam.models import Group +pytestmark = [ + pytest.mark.auth, + pytest.mark.root_user, +] + + @pytest.fixture(autouse=True) def add_second_org(db_session): db_session.add( diff --git a/test/test_auth_su.py b/test/test_auth_su.py index 1243796..2e438fb 100644 --- a/test/test_auth_su.py +++ b/test/test_auth_su.py @@ -10,6 +10,12 @@ from src.organisation.models import OrgUsers from src.user.models import User +pytestmark = [ + pytest.mark.auth, + pytest.mark.super_admin, +] + + @pytest.mark.anyio async def test_get_user_auth_su(no_su_client: AsyncClient): resp = await no_su_client.get("/user/?user_id=1") diff --git a/test/test_auth_user.py b/test/test_auth_user.py index 3cd66d0..99f5579 100644 --- a/test/test_auth_user.py +++ b/test/test_auth_user.py @@ -6,6 +6,12 @@ import pytest from httpx import AsyncClient +pytestmark = [ + pytest.mark.auth, + pytest.mark.user, +] + + @pytest.mark.anyio async def test_get_self_db_auth_user(no_user_client: AsyncClient): resp = await no_user_client.get("/user/self/db") diff --git a/test/test_iam.py b/test/test_iam.py index 1599d7e..af252b4 100644 --- a/test/test_iam.py +++ b/test/test_iam.py @@ -10,6 +10,11 @@ from src.iam.models import Group from .conftest import generate_query_and_status +pytestmark = [ + pytest.mark.iam_module, +] + + @pytest.mark.anyio async def test_post_act_on_resource_endpoint_success(default_client: AsyncClient): body = { diff --git a/test/test_organisation.py b/test/test_organisation.py index a8708ea..03271dc 100644 --- a/test/test_organisation.py +++ b/test/test_organisation.py @@ -10,6 +10,11 @@ from src.user.models import User from .conftest import generate_query_and_status +pytestmark = [ + pytest.mark.org_module, +] + + @pytest.mark.anyio async def test_get_org_success(default_client: AsyncClient): resp = await default_client.get("/org?org_id=1") diff --git a/test/test_service.py b/test/test_service.py index bd8fe88..a65a939 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -8,6 +8,11 @@ from httpx import AsyncClient from .conftest import generate_query_and_status +pytestmark = [ + pytest.mark.service_module, +] + + @pytest.mark.anyio async def test_get_services_success(default_client: AsyncClient): resp = await default_client.get("/service/?org_id=1") diff --git a/test/test_user.py b/test/test_user.py index 0266c7a..9a093ba 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -9,6 +9,11 @@ from httpx import AsyncClient from .conftest import generate_query_and_status +pytestmark = [ + pytest.mark.user_module, +] + + @pytest.mark.anyio async def test_get_self_db_success(default_client: AsyncClient): resp = await default_client.get("/user/self/db")