async def test_serial_not_fixed_relogin(session: ClientSession, connector: Connector, resp: aioresponses) -> None: manager = SystemManager("user", "pass", session, "pymultiMATIC") with open(path("files/responses/zone"), "r") as file: raw_zone = json.loads(file.read()) with open(path("files/responses/facilities"), "r") as file: facilities = json.loads(file.read()) facilities["body"]["facilitiesList"][0]["serialNumber"] = "123" url_zone1 = urls.zone(serial=SERIAL, id="zone") url_zone2 = urls.zone(serial="123", id="zone") url_facilities = urls.facilities_list(serial=SERIAL) resp.get(url_zone1, payload=raw_zone, status=200) resp.get(url_zone2, payload=raw_zone, status=200) resp.get(url_facilities, payload=facilities, status=200) mock_auth(resp) await manager.get_zone("zone") assert manager._serial == SERIAL assert not manager._fixed_serial connector._clear_cookies() await manager.get_zone("zone") assert manager._serial == "123"
from typing import Dict from typing import List from typing import Tuple import pytest from starlette.testclient import TestClient from truth.truth import AssertThat # type: ignore from app import get_application from tests.conftest import POPULATE_SUBMISSION_ID from tests.conftest import mock_auth application = get_application() client: TestClient = TestClient(application) application = mock_auth(application) submission_requests: List[Tuple[str, str, Dict[str, str], int]] = [ ("GET", f"/api/submissions/{str(POPULATE_SUBMISSION_ID)}/votes/", {}, 200), ("GET", f"/api/submissions/{str(POPULATE_SUBMISSION_ID)}/", {}, 200), ] @pytest.mark.parametrize( # pylint: disable=not-callable "method,endpoint,data,expected_status", submission_requests) # pylint: disable=too-many-arguments def test_endpoints( # type: ignore method: str, endpoint: str, data: Dict[str, str], expected_status: int, user_fixture, # pylint: disable=unused-argument