forked from sr2/cloud-api
tests: remove db modifications from individual tests
All db seeding now down in conftest
This commit is contained in:
parent
8b89595531
commit
778f1dbece
8 changed files with 160 additions and 394 deletions
|
|
@ -3,9 +3,6 @@
|
|||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
from src.organisation.models import Organisation as Org
|
||||
from src.user.models import User
|
||||
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.auth,
|
||||
|
|
@ -13,34 +10,9 @@ pytestmark = [
|
|||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_org_auth_root_su(default_client: AsyncClient, db_session):
|
||||
async def test_get_org_auth_root_su(default_client: AsyncClient):
|
||||
# If a super admin can access a resource when not the root user
|
||||
db_session.add(
|
||||
User(
|
||||
email="admin@test.org",
|
||||
first_name="Admin",
|
||||
last_name="Test",
|
||||
oidc_id="abcd-efgh-ijkl-4321",
|
||||
)
|
||||
)
|
||||
db_session.flush()
|
||||
db_session.add(
|
||||
Org(
|
||||
name="Test Org Two",
|
||||
root_user_id=2,
|
||||
billing_contact_id=1,
|
||||
owner_contact_id=2,
|
||||
security_contact_id=3,
|
||||
status="approved",
|
||||
intake_questionnaire={
|
||||
"metadata": {"version": 0, "submission_date": None},
|
||||
"questions": {},
|
||||
},
|
||||
)
|
||||
)
|
||||
db_session.flush()
|
||||
|
||||
resp = await default_client.get("/org?org_id=2")
|
||||
assert resp.status_code != 422
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["organisations"][0]["name"] == "Test Org Two"
|
||||
assert resp.json()["organisations"][0]["name"] == "Org Two"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue