import allure import pytest import requests_async from httpx import HTTPStatusError class TestAuth: async def test_get_access_token_positive(self, target_url:str)->None: with allure.step("get_access_token"), pytest.raises(HTTPStatusError) as exc_info: response = await requests_async.post(f"{target_url}/protected/token") response.raise_for_status() assert exc_info.value.response.status_code != 403 assert exc_info.value.response.status_code != 401 async def test_get_refresh_token_positive(self, target_url:str)->None: with allure.step("get_refresh_token"), pytest.raises(HTTPStatusError) as exc_info: response = await requests_async.post(f"{target_url}/protected/refresh") response.raise_for_status() assert exc_info.value.response.status_code != 403 assert exc_info.value.response.status_code != 401 async def test_get_root_positive(self, target_url:str)->None: with allure.step("get_root"), pytest.raises(HTTPStatusError) as exc_info: response = await requests_async.get(f"{target_url}/protected") response.raise_for_status() assert exc_info.value.response.status_code != 403 assert exc_info.value.response.status_code == 401 @pytest.mark.parametrize("test_user_fixture", [([], [])], indirect=True) async def test_get_logout_positive(self,test_user_fixture, target_url:str)->None: session=test_user_fixture[0] with allure.step("get_root"), pytest.raises(HTTPStatusError) as exc_info: response = await session.get(f"{target_url}/protected/logout") response.raise_for_status() assert exc_info.value.response.status_code != 403 assert exc_info.value.response.status_code != 401