import pytest import requests from tests.integration import config from tests.integration.client import OwsContributor from tests.integration.constants import UNKNOWN_GLOBAL_PARTICIPANT_ID @pytest.fixture(scope="module") def unknown_global_participant_uuid() -> str: return UNKNOWN_GLOBAL_PARTICIPANT_ID class TestGetGlobalParticipant: def test_returns_global_participant( self, client: OwsContributor, global_participant_uuid: str ) -> None: body = client.get_global_participant(id=global_participant_uuid) assert body["id"] == global_participant_uuid assert "name" in body def test_returns_404_when_not_found( self, client: OwsContributor, unknown_global_participant_uuid: str ) -> None: client.get_global_participant( id=unknown_global_participant_uuid, expected_status_code=404, ) def test_returns_401_without_auth( self, unknown_global_participant_uuid: str ) -> None: response = requests.get( f"{config.QA_BASE_URL}/global-participants/{unknown_global_participant_uuid}", ) assert response.status_code == 401 class TestGetGlobalParticipants: def test_returns_global_participants( self, client: OwsContributor, global_participant_uuids: list[str] ) -> None: body = client.get_global_participants(ids=global_participant_uuids) returned_ids = {participant.id for participant in body} assert set(global_participant_uuids).issubset(returned_ids) def test_returns_401_without_auth( self, unknown_global_participant_uuid: str ) -> None: response = requests.post( f"{config.QA_BASE_URL}/global-participants/batch", json={"ids": [unknown_global_participant_uuid]}, ) assert response.status_code == 401