tests: pytest module markers
This commit is contained in:
parent
4ff9edf6d1
commit
bace6388aa
10 changed files with 61 additions and 0 deletions
12
test/pytest.toml
Normal file
12
test/pytest.toml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[tool.pytest]
|
||||
markers = [
|
||||
"iam_module",
|
||||
"org_module",
|
||||
"service_module",
|
||||
"user_module",
|
||||
"auth",
|
||||
"root_user",
|
||||
"super_admin",
|
||||
"user",
|
||||
"preapproval"
|
||||
]
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue