From af196efb6abf5c2fc7fca61ce50d2a111bee66fc Mon Sep 17 00:00:00 2001 From: KlochkovHF Date: Thu, 14 Dec 2023 17:41:10 +0300 Subject: [PATCH 1/4] Move api version to consts --- examples/api_client_with_simple_locks.py | 2 +- huntflow_api_client/api.py | 12 ++++--- tests/api.py | 8 +++-- tests/test_entities/test_account_divisions.py | 8 ++--- tests/test_entities/test_account_offers.py | 6 ++-- .../test_account_vacancy_request.py | 6 ++-- tests/test_entities/test_accounts.py | 8 ++--- tests/test_entities/test_action_logs.py | 4 +-- tests/test_entities/test_applicant_logs.py | 6 ++-- tests/test_entities/test_applicant_offers.py | 8 ++--- .../test_applicant_on_vacancy.py | 8 ++--- .../test_applicant_on_vacancy_statuses.py | 4 +-- tests/test_entities/test_applicants.py | 16 ++++----- tests/test_entities/test_coworkers.py | 6 ++-- tests/test_entities/test_delayed_tasks.py | 4 +-- tests/test_entities/test_dictionaries.py | 10 +++--- tests/test_entities/test_email_templates.py | 4 +-- tests/test_entities/test_file.py | 4 +-- tests/test_entities/test_multi_vacancies.py | 8 ++--- .../test_organization_settings.py | 8 ++--- .../test_entities/test_production_calendar.py | 20 +++++------ tests/test_entities/test_questionary.py | 10 +++--- tests/test_entities/test_regions.py | 4 +-- tests/test_entities/test_rejection_reasons.py | 4 +-- tests/test_entities/test_resume.py | 12 +++---- tests/test_entities/test_survey_type_q.py | 14 ++++---- tests/test_entities/test_tags.py | 16 ++++----- tests/test_entities/test_user_settings.py | 6 ++-- tests/test_entities/test_users.py | 4 +-- tests/test_entities/test_users_management.py | 16 ++++----- tests/test_entities/test_vacancies.py | 36 +++++++++---------- tests/test_entities/test_vacancy_request.py | 10 +++--- tests/test_entities/test_webhooks.py | 8 ++--- tests/test_errors/test_error_handlers.py | 18 +++++----- tests/test_tokens/test_access_token.py | 16 ++++----- 35 files changed, 169 insertions(+), 165 deletions(-) diff --git a/examples/api_client_with_simple_locks.py b/examples/api_client_with_simple_locks.py index e7fd044..97ce05a 100644 --- a/examples/api_client_with_simple_locks.py +++ b/examples/api_client_with_simple_locks.py @@ -37,7 +37,7 @@ def parse_args(): default=3, help="Number of concurrent requests", ) - parser.add_argument("--url", type=str, help="https:///v2") + parser.add_argument("--url", type=str, help="https://") parser.add_argument( "--token-file", type=str, diff --git a/huntflow_api_client/api.py b/huntflow_api_client/api.py index 22e5397..89282aa 100644 --- a/huntflow_api_client/api.py +++ b/huntflow_api_client/api.py @@ -10,19 +10,21 @@ logger = logging.getLogger(__name__) +HUNTFLOW_API_VERSION = "/v2" + class HuntflowAPI: def __init__( self, - base_url: str = "https://api.huntflow.dev/v2", + base_url: str = "https://api.huntflow.dev", # Specify one of this: token or token_proxy token: Optional[ApiToken] = None, token_proxy: Optional[AbstractTokenProxy] = None, auto_refresh_tokens: bool = False, ): """API client. - :param base_url: Base url for API (including schema and version prefix), - like 'https:///v2' + :param base_url: Base url for API (including schema), + like 'https://' :param token: Optional token structure with access token. Use it if you don't care about token refreshing :param token_proxy: Alternative way (see `token` param) to provide token. @@ -39,13 +41,13 @@ def __init__( raise ValueError("Parameters token and token_proxy can't be None at the same time") token_proxy = DummyHuntflowTokenProxy(token) self._token_proxy: AbstractTokenProxy = token_proxy - self.base_url = base_url + self.api_url = base_url + HUNTFLOW_API_VERSION self._autorefresh_tokens = auto_refresh_tokens @property def http_client(self) -> httpx.AsyncClient: - http_client = httpx.AsyncClient(base_url=self.base_url) + http_client = httpx.AsyncClient(base_url=self.api_url) http_client.event_hooks["response"] = [raise_for_status] return http_client diff --git a/tests/api.py b/tests/api.py index adf772c..54ca5bd 100644 --- a/tests/api.py +++ b/tests/api.py @@ -6,9 +6,11 @@ import respx from respx.types import URLPatternTypes +from huntflow_api_client.api import HUNTFLOW_API_VERSION from huntflow_api_client.tokens.storage import HuntflowTokenFileStorage -BASE_URL = "https://api.huntflow.dev/v2" +BASE_URL = "https://api.huntflow.dev" +BASE_URL_WITH_VERSION = BASE_URL + HUNTFLOW_API_VERSION ACCESS_TOKEN_EXPIRES_IN = 86400 * 7 REFRESH_TOKEN_EXPIRES_IN = 86400 * 14 @@ -37,7 +39,7 @@ def inner(*args: Any, **kwargs: Any) -> Any: respx.request( method=self.method, - url=f"{BASE_URL}{self.url}", + url=f"{BASE_URL_WITH_VERSION}{self.url}", name=self.name, ).mock(side_effect=inner) @@ -45,7 +47,7 @@ def inner(*args: Any, **kwargs: Any) -> Any: class FakeAPIServer: - base_url = BASE_URL + base_url = BASE_URL_WITH_VERSION token_pair: TokenPair is_expired_token: bool diff --git a/tests/test_entities/test_account_divisions.py b/tests/test_entities/test_account_divisions.py index aae59a4..48a22a1 100644 --- a/tests/test_entities/test_account_divisions.py +++ b/tests/test_entities/test_account_divisions.py @@ -11,7 +11,7 @@ DivisionsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 COWORKER_ID = 1 @@ -72,7 +72,7 @@ async def test_list_account_division( ) -> None: only_available = True httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/divisions?only_available=true", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/divisions?only_available=true", json=ACCOUNT_DIVISIONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -82,7 +82,7 @@ async def test_list_account_division( assert response == DivisionsListResponse.model_validate(ACCOUNT_DIVISIONS_LIST_RESPONSE) httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}/divisions", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}/divisions", json=ACCOUNT_DIVISIONS_LIST_RESPONSE, ) response = await divisions.list(ACCOUNT_ID, COWORKER_ID) @@ -97,7 +97,7 @@ async def test_create_account_division( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/divisions/batch", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/divisions/batch", json=BATCH_ACCOUNT_DIVISIONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_account_offers.py b/tests/test_entities/test_account_offers.py index a2feafe..d6edd93 100644 --- a/tests/test_entities/test_account_offers.py +++ b/tests/test_entities/test_account_offers.py @@ -9,7 +9,7 @@ AccountOffersListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 OFFER_ID = 2 @@ -119,7 +119,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/offers", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/offers", json=GET_ORG_OFFERS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -134,7 +134,7 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/offers/{OFFER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/offers/{OFFER_ID}", json=GET_ORG_OFFERS_WITH_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_account_vacancy_request.py b/tests/test_entities/test_account_vacancy_request.py index 20126ee..2db14b0 100644 --- a/tests/test_entities/test_account_vacancy_request.py +++ b/tests/test_entities/test_account_vacancy_request.py @@ -7,7 +7,7 @@ AccountVacancyRequestsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 @@ -100,7 +100,7 @@ async def test_list_schemas( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/account_vacancy_requests?only_active=true", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/account_vacancy_requests?only_active=true", json=VACANCY_REQUEST_SCHEMAS_LIST, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -117,7 +117,7 @@ async def test_get_schema( ) -> None: schema_id = 1 httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/account_vacancy_requests/{schema_id}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/account_vacancy_requests/{schema_id}", json=VACANCY_REQUEST_SCHEMA, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_accounts.py b/tests/test_entities/test_accounts.py index 32a75d1..f866b4e 100644 --- a/tests/test_entities/test_accounts.py +++ b/tests/test_entities/test_accounts.py @@ -10,7 +10,7 @@ OrganizationsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 GET_USER_RESPONSE: Dict[str, Any] = { @@ -46,7 +46,7 @@ async def test_get_current_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/me", + url=f"{BASE_URL_WITH_VERSION}/me", json=GET_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -61,7 +61,7 @@ async def test_available_org_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts", + url=f"{BASE_URL_WITH_VERSION}/accounts", json=ORG_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -76,7 +76,7 @@ async def test_get_org_info( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}", json=GET_ORG_INFO_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_action_logs.py b/tests/test_entities/test_action_logs.py index 1ce1449..e3eabde 100644 --- a/tests/test_entities/test_action_logs.py +++ b/tests/test_entities/test_action_logs.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.action_logs import ActionLog from huntflow_api_client.models.response.action_logs import ActionLogsResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 ACTION_LOGS_LIST_RESPONSE: Dict[str, Any] = { @@ -36,7 +36,7 @@ async def test_action_log_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/action_logs?count=30", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/action_logs?count=30", json=ACTION_LOGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_logs.py b/tests/test_entities/test_applicant_logs.py index 8124e76..3cc9d05 100644 --- a/tests/test_entities/test_applicant_logs.py +++ b/tests/test_entities/test_applicant_logs.py @@ -11,7 +11,7 @@ CreateApplicantLogResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -173,7 +173,7 @@ async def test_applicant_log_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs?" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs?" f"vacancy={VACANCY_ID}&&type={ApplicantLogType.ADD.value}&&personal=true" f"&&page=1&&count=30&&personal=false", status_code=200, @@ -197,7 +197,7 @@ async def test_create_log( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs", status_code=200, json=APPLICANT_CREATE_LOG_RESPONSE, ) diff --git a/tests/test_entities/test_applicant_offers.py b/tests/test_entities/test_applicant_offers.py index d996bd1..3d078c7 100644 --- a/tests/test_entities/test_applicant_offers.py +++ b/tests/test_entities/test_applicant_offers.py @@ -7,7 +7,7 @@ from huntflow_api_client.models.request.applicant_offers import ApplicantOfferUpdate from huntflow_api_client.models.response.applicant_offers import ApplicantVacancyOfferResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 OFFER_ID = 2 @@ -34,7 +34,7 @@ async def test_update( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}", json=OFFER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -63,7 +63,7 @@ async def test_get_applicant_on_vacancy_offer( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}" f"/vacancy_frames/{VACANCY_FRAME_ID}/offer?normalize=false", json=OFFER_RESPONSE, ) @@ -83,7 +83,7 @@ async def test_get_offer_pdf( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}/pdf", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}/pdf", content=GET_PDF_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_on_vacancy.py b/tests/test_entities/test_applicant_on_vacancy.py index e81185e..c0575f5 100644 --- a/tests/test_entities/test_applicant_on_vacancy.py +++ b/tests/test_entities/test_applicant_on_vacancy.py @@ -14,7 +14,7 @@ ApplicantVacancySplitResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ID = 1 @@ -51,7 +51,7 @@ async def test_attach_applicant_to_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", json=ATTACH_APPLICANT_TO_VAC_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -73,7 +73,7 @@ async def test_update_vacancy_status_for_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", json=UPDATE_STATUS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -95,7 +95,7 @@ async def test_move_applicant_to_child_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/vacancy/{VACANCY_ID}/split", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/vacancy/{VACANCY_ID}/split", json=MOVE_APPLICANT_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_on_vacancy_statuses.py b/tests/test_entities/test_applicant_on_vacancy_statuses.py index 13c019c..548d70a 100644 --- a/tests/test_entities/test_applicant_on_vacancy_statuses.py +++ b/tests/test_entities/test_applicant_on_vacancy_statuses.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.applicant_on_vacancy_status import ApplicantOnVacancyStatus from huntflow_api_client.models.response.applicant_on_vacancy_status import VacancyStatusesResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ON_VAC_STATUS_LIST_RESPONSE: Dict[str, Any] = { @@ -28,7 +28,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/statuses", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/statuses", json=APPLICANT_ON_VAC_STATUS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicants.py b/tests/test_entities/test_applicants.py index 3933b5c..6941ae6 100644 --- a/tests/test_entities/test_applicants.py +++ b/tests/test_entities/test_applicants.py @@ -15,7 +15,7 @@ ApplicantSearchByCursorResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -275,7 +275,7 @@ async def test_list_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants?count=30&page=1", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants?count=30&page=1", json=APPLICANT_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -290,7 +290,7 @@ async def test_get_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", json=APPLICANT_GET_RESPONSE, ) @@ -306,7 +306,7 @@ async def test_create_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants", json=APPLICANT_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -323,7 +323,7 @@ async def test_patch_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", json=APPLICANT_PATCH_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -340,7 +340,7 @@ async def test_delete_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants" f"/{APPLICANT_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants" f"/{APPLICANT_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -354,7 +354,7 @@ async def test_applicant_search_by_cursor( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" "q=1&&status=1&&rejection_reason=1&&rejection_reason=2&&vacancy=null&&account_source=1" "&&only_current_status=false&&field=all&&count=30", status_code=200, @@ -376,7 +376,7 @@ async def test_applicant_search_by_cursor( ) next_page_cursor = response.next_page_cursor httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" f"next_page_cursor={next_page_cursor}", status_code=200, json=APPLICANT_SEARCH_BY_CURSOR_RESPONSE, diff --git a/tests/test_entities/test_coworkers.py b/tests/test_entities/test_coworkers.py index 07b2a05..822290e 100644 --- a/tests/test_entities/test_coworkers.py +++ b/tests/test_entities/test_coworkers.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.coworkers import Coworker from huntflow_api_client.models.response.coworkers import CoworkerResponse, CoworkersListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 COWORKER_ID = 2 @@ -71,7 +71,7 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}?vacancy_id={VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}?vacancy_id={VACANCY_ID}", json=GET_COWORKER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -87,7 +87,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/coworkers?count=30&page=1", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers?count=30&page=1", json=GET_COWORKER_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_delayed_tasks.py b/tests/test_entities/test_delayed_tasks.py index 5d2b6fa..1fbb94d 100644 --- a/tests/test_entities/test_delayed_tasks.py +++ b/tests/test_entities/test_delayed_tasks.py @@ -4,7 +4,7 @@ from huntflow_api_client.entities import DelayedTask from huntflow_api_client.models.response.delayed_tasks import DelayedTaskResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION DELAYED_TASKS_RESPONSE = { "task_id": "1882e199-a310-4000-8706-490f0822fa01", @@ -33,7 +33,7 @@ async def test_get_delayed_task( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/delayed_tasks/{TASK_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/delayed_tasks/{TASK_ID}", json=DELAYED_TASKS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_dictionaries.py b/tests/test_entities/test_dictionaries.py index 6407c4b..dd86a5e 100644 --- a/tests/test_entities/test_dictionaries.py +++ b/tests/test_entities/test_dictionaries.py @@ -14,7 +14,7 @@ DictionaryTaskResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 DICT_CODE = "dict_code" @@ -102,7 +102,7 @@ async def test_get_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", json=DICT_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -117,7 +117,7 @@ async def test_list_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries", json=DICT_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -132,7 +132,7 @@ async def test_create_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries", json=DICT_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -148,7 +148,7 @@ async def test_update_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", json=DICT_UPDATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_email_templates.py b/tests/test_entities/test_email_templates.py index 5145b6e..85efa6c 100644 --- a/tests/test_entities/test_email_templates.py +++ b/tests/test_entities/test_email_templates.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import MailTemplate from huntflow_api_client.models.response.email_templates import MailTemplatesResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 TEMPLATE_LIST_RESPONSE: Dict[str, Any] = { @@ -46,7 +46,7 @@ async def test_list_templates( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/mail/templates?editable=false", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/mail/templates?editable=false", json=TEMPLATE_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_file.py b/tests/test_entities/test_file.py index 80c7d50..911a65a 100644 --- a/tests/test_entities/test_file.py +++ b/tests/test_entities/test_file.py @@ -7,7 +7,7 @@ from huntflow_api_client.models.request.file import UploadFileHeaders from huntflow_api_client.models.response.file import UploadResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 UPLOAD_FILE_RESPONSE: Dict[str, Any] = { @@ -43,7 +43,7 @@ async def test_upload_file( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/upload", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/upload", json=UPLOAD_FILE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_multi_vacancies.py b/tests/test_entities/test_multi_vacancies.py index 5b7baaf..df68d38 100644 --- a/tests/test_entities/test_multi_vacancies.py +++ b/tests/test_entities/test_multi_vacancies.py @@ -15,7 +15,7 @@ ) from huntflow_api_client.models.response.muilti_vacancies import MultiVacancyResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 VACANCY_ID = 2 @@ -27,7 +27,7 @@ async def test_create_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies", json=MULTI_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -47,7 +47,7 @@ async def test_update_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", json=MULTI_VACANCY_RESPONSE, method="PUT", ) @@ -67,7 +67,7 @@ async def test_partial_update_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", json=MULTI_VACANCY_RESPONSE, method="PATCH", ) diff --git a/tests/test_entities/test_organization_settings.py b/tests/test_entities/test_organization_settings.py index a6364ad..8c3c037 100644 --- a/tests/test_entities/test_organization_settings.py +++ b/tests/test_entities/test_organization_settings.py @@ -10,7 +10,7 @@ HoldReasonsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 SURVEY_ID = 2 @@ -34,7 +34,7 @@ async def test_get_hold_reasons( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_hold_reasons", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_hold_reasons", json=HOLD_REASONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -49,7 +49,7 @@ async def test_get_close_reasons( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_close_reasons", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_close_reasons", json=CLOSE_REASONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -64,7 +64,7 @@ async def test_get_applicant_survey_form( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_a/{SURVEY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_a/{SURVEY_ID}", json=SURVEY_FORM_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_production_calendar.py b/tests/test_entities/test_production_calendar.py index 37c9add..82779c2 100644 --- a/tests/test_entities/test_production_calendar.py +++ b/tests/test_entities/test_production_calendar.py @@ -21,7 +21,7 @@ NonWorkingDaysResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 CALENDAR_ID = 1 @@ -64,7 +64,7 @@ async def test_list_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars", + url=f"{BASE_URL_WITH_VERSION}/production_calendars", json=CALENDAR_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -79,7 +79,7 @@ async def test_get_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}", + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}", json=CALENDAR_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -94,7 +94,7 @@ async def test_get_organizations_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/calendar", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/calendar", json=ORG_CALENDAR_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -109,7 +109,7 @@ async def test_get_non_working_days_in_period( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/days/" + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/days/" f"{DEADLINE_DATE.strftime('%Y-%m-%d')}?verbose=true", json=NON_WORKING_DAYS_GET_RESPONSE, ) @@ -125,7 +125,7 @@ async def test_get_non_working_days_for_multiple_period( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/days", + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/days", json=MULTIPLE_NON_WORKING_DAYS_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -148,7 +148,7 @@ async def test_get_deadline_date_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/deadline/{DAYS_COUNT}?start=" + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/deadline/{DAYS_COUNT}?start=" f"{START_DATE}", json=DEADLINE_RESPONSE, ) @@ -168,7 +168,7 @@ async def test_get_multiple_deadline_dates_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/deadline", + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/deadline", json=MULTIPLE_DEADLINE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -193,7 +193,7 @@ async def test_get_start_date_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/start/{DAYS_COUNT}?deadline=" + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/start/{DAYS_COUNT}?deadline=" f"{DEADLINE_DATE}", json=DEADLINE_RESPONSE, ) @@ -213,7 +213,7 @@ async def test_get_multiple_start_dates_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/production_calendars/{CALENDAR_ID}/start", + url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/start", json=MULTIPLE_START_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_questionary.py b/tests/test_entities/test_questionary.py index 481d1f1..2eed0c9 100644 --- a/tests/test_entities/test_questionary.py +++ b/tests/test_entities/test_questionary.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import ApplicantsQuestionary from huntflow_api_client.models.response.questionary import QuestionarySchemaResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -51,7 +51,7 @@ async def test_get_schema( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/questionary", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/questionary", json=QUESTIONARY_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -66,7 +66,7 @@ async def test_create_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -82,7 +82,7 @@ async def test_get_applicants_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -97,7 +97,7 @@ async def test_update_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_regions.py b/tests/test_entities/test_regions.py index 3725f3b..56b852a 100644 --- a/tests/test_entities/test_regions.py +++ b/tests/test_entities/test_regions.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.regions import Region from huntflow_api_client.models.response.regions import RegionsListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 REGIONS_LIST_RESPONSE: Dict[str, Any] = { @@ -20,7 +20,7 @@ async def test_regions_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/regions", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/regions", json=REGIONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_rejection_reasons.py b/tests/test_entities/test_rejection_reasons.py index 658e7d3..3504124 100644 --- a/tests/test_entities/test_rejection_reasons.py +++ b/tests/test_entities/test_rejection_reasons.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.rejection_reason import RejectionReason from huntflow_api_client.models.response.rejection_reason import RejectionReasonsListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 REJECTION_REASONS_LIST_RESPONSE: Dict[str, Any] = { @@ -19,7 +19,7 @@ async def test_rejection_reasons_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/rejection_reasons", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/rejection_reasons", json=REJECTION_REASONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_resume.py b/tests/test_entities/test_resume.py index 0a10ed9..ffc5e12 100644 --- a/tests/test_entities/test_resume.py +++ b/tests/test_entities/test_resume.py @@ -13,7 +13,7 @@ ApplicantSourcesResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -295,7 +295,7 @@ async def test_get_resume_sources( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/sources", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/sources", json=RESUME_SOURCES_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -310,7 +310,7 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", json=APPLICANT_RESUME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -325,7 +325,7 @@ async def test_delete_resume( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -339,7 +339,7 @@ async def test_update( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", json=APPLICANT_RESUME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -359,7 +359,7 @@ async def test_get_resume_pdf( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/" f"externals/{EXTERNAL_ID}/pdf", content=GET_PDF_RESPONSE, ) diff --git a/tests/test_entities/test_survey_type_q.py b/tests/test_entities/test_survey_type_q.py index 0fc45bd..3c89952 100644 --- a/tests/test_entities/test_survey_type_q.py +++ b/tests/test_entities/test_survey_type_q.py @@ -10,7 +10,7 @@ SurveySchemaTypeQResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 @@ -166,7 +166,7 @@ async def test_list_schemas( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q?active=true", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q?active=true", json=SURVEY_QUESTIONARY_SCHEMAS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -184,7 +184,7 @@ async def test_get_schema( ) -> None: survey_id = 1 httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/{survey_id}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/{survey_id}", json=SURVEY_QUESTIONARY_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -202,7 +202,7 @@ async def test_create_survey_questionary( ) -> None: request_data = SurveyQuestionaryCreateRequest.model_validate(SURVEY_QUESTIONARY_CREATE_REQUEST) httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries", json=APPLICANT_SURVEY_QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -220,7 +220,7 @@ async def test_get_survey_questionary( ) -> None: questionary_id = 1 httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", json=APPLICANT_SURVEY_QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -238,7 +238,7 @@ async def test_delete_survey_questionary( ) -> None: questionary_id = 1 httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) questionary = SurveyTypeQ(api_client) @@ -252,7 +252,7 @@ async def test_get_answer( ) -> None: answer_id = 1 httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/answers/{answer_id}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/answers/{answer_id}", json=SURVEY_QUESTIONARY_ANSWER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_tags.py b/tests/test_entities/test_tags.py index bb69dad..f56cd8f 100644 --- a/tests/test_entities/test_tags.py +++ b/tests/test_entities/test_tags.py @@ -14,7 +14,7 @@ ApplicantTagsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 TAG_ID = 2 @@ -40,7 +40,7 @@ async def test_get_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -55,7 +55,7 @@ async def test_create_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/tags", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -72,7 +72,7 @@ async def test_update_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -89,7 +89,7 @@ async def test_delete_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -104,7 +104,7 @@ async def test_list_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/tags", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags", json=ACCOUNT_TAGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -119,7 +119,7 @@ async def test_list_applicant_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", json=APPLICANT_TAGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -134,7 +134,7 @@ async def test_update_applicant_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", json=APPLICANT_TAGS_UPDATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_user_settings.py b/tests/test_entities/test_user_settings.py index 683eadc..7b624c5 100644 --- a/tests/test_entities/test_user_settings.py +++ b/tests/test_entities/test_user_settings.py @@ -9,7 +9,7 @@ EmailAccountsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION GET_USER_EMAIL_ACCOUNTS_RESPONSE: Dict[str, Any] = { "items": [ @@ -49,7 +49,7 @@ async def test_get_email_accounts( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/email_accounts", + url=f"{BASE_URL_WITH_VERSION}/email_accounts", json=GET_USER_EMAIL_ACCOUNTS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -64,7 +64,7 @@ async def test_get_calendar_accounts( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/calendar_accounts", + url=f"{BASE_URL_WITH_VERSION}/calendar_accounts", json=GET_USER_CALENDAR_ACCOUNTS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_users.py b/tests/test_entities/test_users.py index 6778a0c..8ae76b8 100644 --- a/tests/test_entities/test_users.py +++ b/tests/test_entities/test_users.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import User from huntflow_api_client.models.response.users import UserResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 USER_ID = 2 @@ -27,7 +27,7 @@ async def test_get_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/{USER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/{USER_ID}", json=GET_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_users_management.py b/tests/test_entities/test_users_management.py index 0a12a37..3a08202 100644 --- a/tests/test_entities/test_users_management.py +++ b/tests/test_entities/test_users_management.py @@ -14,7 +14,7 @@ UserInternalIDResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 FOREIGN_USER_ID = "some_foreign_id" @@ -75,7 +75,7 @@ async def test_get_users_with_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign?count=30&page=1", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign?count=30&page=1", json=GET_USERS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -90,7 +90,7 @@ async def test_get_user_by_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", json=GET_USER_BY_FOREIGN_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -108,7 +108,7 @@ async def test_get_user_control_task( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/task/{TASK_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/task/{TASK_ID}", json=GET_USER_CONTROL_TASK_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -123,7 +123,7 @@ async def test_get_user_internal_id_by_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}/id", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}/id", json=GET_USER_ID_BY_FOREIGN_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -141,7 +141,7 @@ async def test_delete_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", status_code=202, json=CREATE_USER_TASK_RESPONSE, ) @@ -157,7 +157,7 @@ async def test_create_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign", json=CREATE_USER_TASK_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -177,7 +177,7 @@ async def test_update_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", json=UPDATE_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_vacancies.py b/tests/test_entities/test_vacancies.py index c8f9ba0..096f805 100644 --- a/tests/test_entities/test_vacancies.py +++ b/tests/test_entities/test_vacancies.py @@ -27,7 +27,7 @@ VacancyStatusGroupsResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 VACANCY_ID = 2 @@ -277,7 +277,7 @@ async def test_get_get_org_vacancy_additional_fields_schema( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/additional_fields", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/additional_fields", json=GET_ORG_ADD_FIELDS_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -292,7 +292,7 @@ async def test_list_vacancies( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies?" + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies?" f"count=30&page=1&mine=false&state=OPEN&state=HOLD", json=GET_LIST_VACANCIES_RESPONSE, ) @@ -309,7 +309,7 @@ async def test_get_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=GET_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -324,7 +324,7 @@ async def test_create_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies", json=CREATE_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -348,7 +348,7 @@ async def test_update_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=UPDATE_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -368,7 +368,7 @@ async def test_delete_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -382,7 +382,7 @@ async def test_patch_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=PATCH_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -400,7 +400,7 @@ async def test_assign_coworker( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", json=ASSIGN_COWORKER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -416,7 +416,7 @@ async def test_remove_coworker( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -430,7 +430,7 @@ async def test_vacancy_frames_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames", json=VACANCY_FRAME_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -445,7 +445,7 @@ async def test_get_last_vacancy_frame( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frame", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frame", json=LAST_VACANCY_FRAME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -460,7 +460,7 @@ async def test_get_vacancy_quotas_in_frame( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames/{FRAME_ID}/quotas", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames/{FRAME_ID}/quotas", json=VACANCY_QUOTAS_IN_FRAME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -475,7 +475,7 @@ async def test_get_vacancy_quota_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/quotas?count=2&page=1", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/quotas?count=2&page=1", json=VACANCY_QUOTAS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -490,7 +490,7 @@ async def test_get_vacancy_status_groups( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/status_groups", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/status_groups", json=VACANCY_STATUS_GROUPS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -505,7 +505,7 @@ async def test_close_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/close", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/close", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) @@ -519,7 +519,7 @@ async def test_hold_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/hold", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/hold", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) @@ -533,7 +533,7 @@ async def test_resume_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/resume", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/resume", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) diff --git a/tests/test_entities/test_vacancy_request.py b/tests/test_entities/test_vacancy_request.py index 211b16c..915cd83 100644 --- a/tests/test_entities/test_vacancy_request.py +++ b/tests/test_entities/test_vacancy_request.py @@ -8,7 +8,7 @@ VacancyRequestResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 @@ -82,7 +82,7 @@ async def test_list_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests?page=1&&count=30&&values=false", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests?page=1&&count=30&&values=false", json=VACANCY_REQUEST_LIST_WITHOUT_VALUES, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -95,7 +95,7 @@ async def test_list_vacancy_request( httpx_mock.add_response( url=( - f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests?" + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests?" f"vacancy_id=1&&page=1&&count=30&&values=true" ), json=VACANCY_REQUEST_LIST_WITH_VALUES, @@ -110,7 +110,7 @@ async def test_get_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests/1", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests/1", json=VACANCY_REQUEST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -126,7 +126,7 @@ async def test_create_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests", json=VACANCY_REQUEST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_webhooks.py b/tests/test_entities/test_webhooks.py index 93037db..e1de919 100644 --- a/tests/test_entities/test_webhooks.py +++ b/tests/test_entities/test_webhooks.py @@ -8,7 +8,7 @@ from huntflow_api_client.models.request.webhooks import WebhookRequest from huntflow_api_client.models.response.webhooks import WebhookResponse, WebhooksListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION ACCOUNT_ID = 1 HOOK_ID = 2 @@ -41,7 +41,7 @@ async def test_list_webhooks( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/hooks", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks", json=WEBHOOK_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -56,7 +56,7 @@ async def test_create_webhook( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/hooks", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks", json=WEBHOOK_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -77,7 +77,7 @@ async def test_delete_webhook( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/{ACCOUNT_ID}/hooks/{HOOK_ID}", + url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks/{HOOK_ID}", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) webhooks = Webhook(api_client) diff --git a/tests/test_errors/test_error_handlers.py b/tests/test_errors/test_error_handlers.py index a89c251..ffa19c6 100644 --- a/tests/test_errors/test_error_handlers.py +++ b/tests/test_errors/test_error_handlers.py @@ -15,7 +15,7 @@ TooManyRequestsError, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL +from tests.api import BASE_URL, BASE_URL_WITH_VERSION @pytest.fixture() @@ -24,7 +24,7 @@ def api_client(token_proxy: HuntflowTokenProxy) -> HuntflowAPI: class TestErrorHandler401: - url = f"{BASE_URL}/me" + url = f"{BASE_URL_WITH_VERSION}/me" async def test_authorization_error( self, @@ -90,7 +90,7 @@ async def test_token_expired_error( class TestErrorHandler400: - url = f"{BASE_URL}/accounts/11/vacancies" + url = f"{BASE_URL_WITH_VERSION}/accounts/11/vacancies" async def test_bad_request_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response( @@ -131,7 +131,7 @@ async def test_bad_request_error(self, httpx_mock: HTTPXMock, api_client: Huntfl class TestErrorHandler402: - url = f"{BASE_URL}/me" + url = f"{BASE_URL_WITH_VERSION}/me" async def test_payment_required_error( self, @@ -152,7 +152,7 @@ async def test_payment_required_error( class TestErrorHandler403: - url = f"{BASE_URL}/me" + url = f"{BASE_URL_WITH_VERSION}/me" async def test_access_denied_error( self, @@ -175,7 +175,7 @@ async def test_access_denied_error( class TestErrorHandler404: async def test_not_found_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/accounts/11/vacancy_requests/0", + url=f"{BASE_URL_WITH_VERSION}/accounts/11/vacancy_requests/0", method="GET", status_code=404, json={"errors": [{"type": "not_found", "title": "Unknown vacancy request"}]}, @@ -192,7 +192,7 @@ async def test_invalid_refresh_token_error( api_client: HuntflowAPI, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL}/token/refresh", + url=f"{BASE_URL_WITH_VERSION}/token/refresh", method="POST", status_code=404, json={"errors": [{"type": "not_found", "title": "error.robot_token.not_found"}]}, @@ -205,7 +205,7 @@ async def test_invalid_refresh_token_error( class TestErrorHandler429: - url = f"{BASE_URL}/me" + url = f"{BASE_URL_WITH_VERSION}/me" async def test_too_many_requests_error( self, @@ -235,7 +235,7 @@ async def test_too_many_requests_error( class TestDefaultErrorHandler: - url = f"{BASE_URL}/me" + url = f"{BASE_URL_WITH_VERSION}/me" async def test_api_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response( diff --git a/tests/test_tokens/test_access_token.py b/tests/test_tokens/test_access_token.py index b061456..5f7dcfe 100644 --- a/tests/test_tokens/test_access_token.py +++ b/tests/test_tokens/test_access_token.py @@ -13,7 +13,7 @@ from huntflow_api_client.tokens.locker import AsyncioLockLocker from huntflow_api_client.tokens.proxy import HuntflowTokenProxy from huntflow_api_client.tokens.storage import HuntflowTokenFileStorage -from tests.api import FakeAPIServer, TokenPair +from tests.api import FakeAPIServer, TokenPair, BASE_URL @respx.mock @@ -22,7 +22,7 @@ async def test_valid_access_token__ok( token_proxy: HuntflowTokenProxy, ) -> None: api = HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=True, ) @@ -39,7 +39,7 @@ async def test_access_token_invalid__error( token_proxy: HuntflowTokenProxy, ) -> None: huntflow_api = HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=False, ) @@ -60,7 +60,7 @@ async def test_access_token_expired__error( token_proxy: HuntflowTokenProxy, ) -> None: huntflow_api = HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=False, ) @@ -81,7 +81,7 @@ async def test_invalid_refresh_token__error( token_proxy: HuntflowTokenProxy, ) -> None: huntflow_api = HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=True, ) @@ -108,7 +108,7 @@ async def test_auto_refresh_tokens__ok( token_proxy: HuntflowTokenProxy, ) -> None: huntflow_api = HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=True, ) @@ -132,7 +132,7 @@ async def test_auto_refresh_tokens_several_api_one_proxy__ok( api_count = 10 apis = [ HuntflowAPI( - fake_server.base_url, + BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=True, ) @@ -174,7 +174,7 @@ async def test_auto_refresh_tokens_several_api_several_proxies__ok( for _ in range(api_count): storage = HuntflowTokenFileStorage(token_filename) token_proxy = HuntflowTokenProxy(storage, locker) - api = HuntflowAPI(fake_server.base_url, token_proxy=token_proxy, auto_refresh_tokens=True) + api = HuntflowAPI(BASE_URL, token_proxy=token_proxy, auto_refresh_tokens=True) apis.append(api) fake_server.expire_token() From e6426f1c49c6b60fee3d8fb909a88e69be7048bc Mon Sep 17 00:00:00 2001 From: KlochkovHF Date: Thu, 14 Dec 2023 17:47:09 +0300 Subject: [PATCH 2/4] codestyle --- .../test_account_vacancy_request.py | 5 ++++- tests/test_entities/test_applicant_offers.py | 10 ++++++++-- tests/test_entities/test_coworkers.py | 5 ++++- .../test_entities/test_production_calendar.py | 12 +++++++---- tests/test_entities/test_resume.py | 15 +++++++++++--- tests/test_entities/test_survey_type_q.py | 10 ++++++++-- tests/test_entities/test_vacancies.py | 20 +++++++++++++++---- tests/test_entities/test_vacancy_request.py | 5 ++++- tests/test_tokens/test_access_token.py | 2 +- 9 files changed, 65 insertions(+), 19 deletions(-) diff --git a/tests/test_entities/test_account_vacancy_request.py b/tests/test_entities/test_account_vacancy_request.py index 2db14b0..0928647 100644 --- a/tests/test_entities/test_account_vacancy_request.py +++ b/tests/test_entities/test_account_vacancy_request.py @@ -100,7 +100,10 @@ async def test_list_schemas( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/account_vacancy_requests?only_active=true", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + "/account_vacancy_requests?only_active=true" + ), json=VACANCY_REQUEST_SCHEMAS_LIST, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_offers.py b/tests/test_entities/test_applicant_offers.py index 3d078c7..b28cd01 100644 --- a/tests/test_entities/test_applicant_offers.py +++ b/tests/test_entities/test_applicant_offers.py @@ -34,7 +34,10 @@ async def test_update( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/applicants/{APPLICANT_ID}/offers/{OFFER_ID}" + ), json=OFFER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -83,7 +86,10 @@ async def test_get_offer_pdf( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/offers/{OFFER_ID}/pdf", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/applicants/{APPLICANT_ID}/offers/{OFFER_ID}/pdf" + ), content=GET_PDF_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_coworkers.py b/tests/test_entities/test_coworkers.py index 822290e..20a29d9 100644 --- a/tests/test_entities/test_coworkers.py +++ b/tests/test_entities/test_coworkers.py @@ -71,7 +71,10 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}?vacancy_id={VACANCY_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/coworkers/{COWORKER_ID}?vacancy_id={VACANCY_ID}" + ), json=GET_COWORKER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_production_calendar.py b/tests/test_entities/test_production_calendar.py index 82779c2..1d281a9 100644 --- a/tests/test_entities/test_production_calendar.py +++ b/tests/test_entities/test_production_calendar.py @@ -148,8 +148,10 @@ async def test_get_deadline_date_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/deadline/{DAYS_COUNT}?start=" - f"{START_DATE}", + url=( + f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}" + f"/deadline/{DAYS_COUNT}?start={START_DATE}" + ), json=DEADLINE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -193,8 +195,10 @@ async def test_get_start_date_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/start/{DAYS_COUNT}?deadline=" - f"{DEADLINE_DATE}", + url=( + f"{BASE_URL_WITH_VERSION}/production_calendars" + f"/{CALENDAR_ID}/start/{DAYS_COUNT}?deadline={DEADLINE_DATE}" + ), json=DEADLINE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_resume.py b/tests/test_entities/test_resume.py index ffc5e12..d26ba0c 100644 --- a/tests/test_entities/test_resume.py +++ b/tests/test_entities/test_resume.py @@ -310,7 +310,10 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" + ), json=APPLICANT_RESUME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -325,7 +328,10 @@ async def test_delete_resume( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" + ), status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -339,7 +345,10 @@ async def test_update( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" + ), json=APPLICANT_RESUME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_survey_type_q.py b/tests/test_entities/test_survey_type_q.py index 3c89952..355dc87 100644 --- a/tests/test_entities/test_survey_type_q.py +++ b/tests/test_entities/test_survey_type_q.py @@ -220,7 +220,10 @@ async def test_get_survey_questionary( ) -> None: questionary_id = 1 httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/surveys/type_q/questionaries/{questionary_id}" + ), json=APPLICANT_SURVEY_QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -238,7 +241,10 @@ async def test_delete_survey_questionary( ) -> None: questionary_id = 1 httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries/{questionary_id}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/surveys/type_q/questionaries/{questionary_id}" + ), ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) questionary = SurveyTypeQ(api_client) diff --git a/tests/test_entities/test_vacancies.py b/tests/test_entities/test_vacancies.py index 096f805..04a1dfd 100644 --- a/tests/test_entities/test_vacancies.py +++ b/tests/test_entities/test_vacancies.py @@ -400,7 +400,10 @@ async def test_assign_coworker( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/vacancies/{VACANCY_ID}/members/{COWORKER_ID}" + ), json=ASSIGN_COWORKER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -416,7 +419,10 @@ async def test_remove_coworker( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/members/{COWORKER_ID}", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/vacancies/{VACANCY_ID}/members/{COWORKER_ID}" + ), status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -460,7 +466,10 @@ async def test_get_vacancy_quotas_in_frame( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames/{FRAME_ID}/quotas", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/vacancies/{VACANCY_ID}/frames/{FRAME_ID}/quotas" + ), json=VACANCY_QUOTAS_IN_FRAME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -475,7 +484,10 @@ async def test_get_vacancy_quota_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/quotas?count=2&page=1", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/vacancies/{VACANCY_ID}/quotas?count=2&page=1" + ), json=VACANCY_QUOTAS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_vacancy_request.py b/tests/test_entities/test_vacancy_request.py index 915cd83..0bc9cf5 100644 --- a/tests/test_entities/test_vacancy_request.py +++ b/tests/test_entities/test_vacancy_request.py @@ -82,7 +82,10 @@ async def test_list_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests?page=1&&count=30&&values=false", + url=( + f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"/vacancy_requests?page=1&&count=30&&values=false" + ), json=VACANCY_REQUEST_LIST_WITHOUT_VALUES, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_tokens/test_access_token.py b/tests/test_tokens/test_access_token.py index 5f7dcfe..7351614 100644 --- a/tests/test_tokens/test_access_token.py +++ b/tests/test_tokens/test_access_token.py @@ -13,7 +13,7 @@ from huntflow_api_client.tokens.locker import AsyncioLockLocker from huntflow_api_client.tokens.proxy import HuntflowTokenProxy from huntflow_api_client.tokens.storage import HuntflowTokenFileStorage -from tests.api import FakeAPIServer, TokenPair, BASE_URL +from tests.api import BASE_URL, FakeAPIServer, TokenPair @respx.mock From a560ed315498dab01b320b9fadb8f08c7ddbc665 Mon Sep 17 00:00:00 2001 From: KlochkovHF Date: Thu, 14 Dec 2023 17:56:54 +0300 Subject: [PATCH 3/4] remove base_url from FakeAPIServer --- tests/api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/api.py b/tests/api.py index 54ca5bd..6a7b4bc 100644 --- a/tests/api.py +++ b/tests/api.py @@ -47,7 +47,6 @@ def inner(*args: Any, **kwargs: Any) -> Any: class FakeAPIServer: - base_url = BASE_URL_WITH_VERSION token_pair: TokenPair is_expired_token: bool From 5ea1792f16598f263412cfb0bf9fa64f9e03816c Mon Sep 17 00:00:00 2001 From: KlochkovHF Date: Fri, 15 Dec 2023 12:55:42 +0300 Subject: [PATCH 4/4] Fix comments --- huntflow_api_client/api.py | 4 +-- tests/api.py | 6 ++-- tests/test_entities/test_account_divisions.py | 8 ++--- tests/test_entities/test_account_offers.py | 6 ++-- .../test_account_vacancy_request.py | 6 ++-- tests/test_entities/test_accounts.py | 8 ++--- tests/test_entities/test_action_logs.py | 4 +-- tests/test_entities/test_applicant_logs.py | 6 ++-- tests/test_entities/test_applicant_offers.py | 8 ++--- .../test_applicant_on_vacancy.py | 8 ++--- .../test_applicant_on_vacancy_statuses.py | 4 +-- tests/test_entities/test_applicants.py | 16 ++++----- tests/test_entities/test_coworkers.py | 6 ++-- tests/test_entities/test_delayed_tasks.py | 4 +-- tests/test_entities/test_dictionaries.py | 10 +++--- tests/test_entities/test_email_templates.py | 4 +-- tests/test_entities/test_file.py | 4 +-- tests/test_entities/test_multi_vacancies.py | 8 ++--- .../test_organization_settings.py | 8 ++--- .../test_entities/test_production_calendar.py | 20 +++++------ tests/test_entities/test_questionary.py | 10 +++--- tests/test_entities/test_regions.py | 4 +-- tests/test_entities/test_rejection_reasons.py | 4 +-- tests/test_entities/test_resume.py | 12 +++---- tests/test_entities/test_survey_type_q.py | 14 ++++---- tests/test_entities/test_tags.py | 16 ++++----- tests/test_entities/test_user_settings.py | 6 ++-- tests/test_entities/test_users.py | 4 +-- tests/test_entities/test_users_management.py | 16 ++++----- tests/test_entities/test_vacancies.py | 36 +++++++++---------- tests/test_entities/test_vacancy_request.py | 10 +++--- tests/test_entities/test_webhooks.py | 8 ++--- tests/test_errors/test_error_handlers.py | 18 +++++----- 33 files changed, 153 insertions(+), 153 deletions(-) diff --git a/huntflow_api_client/api.py b/huntflow_api_client/api.py index 89282aa..c63df71 100644 --- a/huntflow_api_client/api.py +++ b/huntflow_api_client/api.py @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) -HUNTFLOW_API_VERSION = "/v2" +API_VERSION_PATH = "/v2" class HuntflowAPI: @@ -41,7 +41,7 @@ def __init__( raise ValueError("Parameters token and token_proxy can't be None at the same time") token_proxy = DummyHuntflowTokenProxy(token) self._token_proxy: AbstractTokenProxy = token_proxy - self.api_url = base_url + HUNTFLOW_API_VERSION + self.api_url = base_url + API_VERSION_PATH self._autorefresh_tokens = auto_refresh_tokens diff --git a/tests/api.py b/tests/api.py index 6a7b4bc..6ee5e78 100644 --- a/tests/api.py +++ b/tests/api.py @@ -6,11 +6,11 @@ import respx from respx.types import URLPatternTypes -from huntflow_api_client.api import HUNTFLOW_API_VERSION +from huntflow_api_client.api import API_VERSION_PATH from huntflow_api_client.tokens.storage import HuntflowTokenFileStorage BASE_URL = "https://api.huntflow.dev" -BASE_URL_WITH_VERSION = BASE_URL + HUNTFLOW_API_VERSION +VERSIONED_BASE_URL = BASE_URL + API_VERSION_PATH ACCESS_TOKEN_EXPIRES_IN = 86400 * 7 REFRESH_TOKEN_EXPIRES_IN = 86400 * 14 @@ -39,7 +39,7 @@ def inner(*args: Any, **kwargs: Any) -> Any: respx.request( method=self.method, - url=f"{BASE_URL_WITH_VERSION}{self.url}", + url=f"{VERSIONED_BASE_URL}{self.url}", name=self.name, ).mock(side_effect=inner) diff --git a/tests/test_entities/test_account_divisions.py b/tests/test_entities/test_account_divisions.py index 48a22a1..128f3f7 100644 --- a/tests/test_entities/test_account_divisions.py +++ b/tests/test_entities/test_account_divisions.py @@ -11,7 +11,7 @@ DivisionsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 COWORKER_ID = 1 @@ -72,7 +72,7 @@ async def test_list_account_division( ) -> None: only_available = True httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/divisions?only_available=true", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/divisions?only_available=true", json=ACCOUNT_DIVISIONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -82,7 +82,7 @@ async def test_list_account_division( assert response == DivisionsListResponse.model_validate(ACCOUNT_DIVISIONS_LIST_RESPONSE) httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}/divisions", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/coworkers/{COWORKER_ID}/divisions", json=ACCOUNT_DIVISIONS_LIST_RESPONSE, ) response = await divisions.list(ACCOUNT_ID, COWORKER_ID) @@ -97,7 +97,7 @@ async def test_create_account_division( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/divisions/batch", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/divisions/batch", json=BATCH_ACCOUNT_DIVISIONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_account_offers.py b/tests/test_entities/test_account_offers.py index d6edd93..49d2441 100644 --- a/tests/test_entities/test_account_offers.py +++ b/tests/test_entities/test_account_offers.py @@ -9,7 +9,7 @@ AccountOffersListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 OFFER_ID = 2 @@ -119,7 +119,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/offers", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/offers", json=GET_ORG_OFFERS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -134,7 +134,7 @@ async def test_get( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/offers/{OFFER_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/offers/{OFFER_ID}", json=GET_ORG_OFFERS_WITH_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_account_vacancy_request.py b/tests/test_entities/test_account_vacancy_request.py index 0928647..8fdd200 100644 --- a/tests/test_entities/test_account_vacancy_request.py +++ b/tests/test_entities/test_account_vacancy_request.py @@ -7,7 +7,7 @@ AccountVacancyRequestsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 @@ -101,7 +101,7 @@ async def test_list_schemas( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" "/account_vacancy_requests?only_active=true" ), json=VACANCY_REQUEST_SCHEMAS_LIST, @@ -120,7 +120,7 @@ async def test_get_schema( ) -> None: schema_id = 1 httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/account_vacancy_requests/{schema_id}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/account_vacancy_requests/{schema_id}", json=VACANCY_REQUEST_SCHEMA, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_accounts.py b/tests/test_entities/test_accounts.py index f866b4e..9dd101e 100644 --- a/tests/test_entities/test_accounts.py +++ b/tests/test_entities/test_accounts.py @@ -10,7 +10,7 @@ OrganizationsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 GET_USER_RESPONSE: Dict[str, Any] = { @@ -46,7 +46,7 @@ async def test_get_current_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/me", + url=f"{VERSIONED_BASE_URL}/me", json=GET_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -61,7 +61,7 @@ async def test_available_org_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts", + url=f"{VERSIONED_BASE_URL}/accounts", json=ORG_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -76,7 +76,7 @@ async def test_get_org_info( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}", json=GET_ORG_INFO_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_action_logs.py b/tests/test_entities/test_action_logs.py index e3eabde..1e62f64 100644 --- a/tests/test_entities/test_action_logs.py +++ b/tests/test_entities/test_action_logs.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.action_logs import ActionLog from huntflow_api_client.models.response.action_logs import ActionLogsResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 ACTION_LOGS_LIST_RESPONSE: Dict[str, Any] = { @@ -36,7 +36,7 @@ async def test_action_log_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/action_logs?count=30", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/action_logs?count=30", json=ACTION_LOGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_logs.py b/tests/test_entities/test_applicant_logs.py index 3cc9d05..ae5b775 100644 --- a/tests/test_entities/test_applicant_logs.py +++ b/tests/test_entities/test_applicant_logs.py @@ -11,7 +11,7 @@ CreateApplicantLogResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -173,7 +173,7 @@ async def test_applicant_log_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs?" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs?" f"vacancy={VACANCY_ID}&&type={ApplicantLogType.ADD.value}&&personal=true" f"&&page=1&&count=30&&personal=false", status_code=200, @@ -197,7 +197,7 @@ async def test_create_log( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/logs", status_code=200, json=APPLICANT_CREATE_LOG_RESPONSE, ) diff --git a/tests/test_entities/test_applicant_offers.py b/tests/test_entities/test_applicant_offers.py index b28cd01..a69c9ee 100644 --- a/tests/test_entities/test_applicant_offers.py +++ b/tests/test_entities/test_applicant_offers.py @@ -7,7 +7,7 @@ from huntflow_api_client.models.request.applicant_offers import ApplicantOfferUpdate from huntflow_api_client.models.response.applicant_offers import ApplicantVacancyOfferResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 OFFER_ID = 2 @@ -35,7 +35,7 @@ async def test_update( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/applicants/{APPLICANT_ID}/offers/{OFFER_ID}" ), json=OFFER_RESPONSE, @@ -66,7 +66,7 @@ async def test_get_applicant_on_vacancy_offer( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}" f"/vacancy_frames/{VACANCY_FRAME_ID}/offer?normalize=false", json=OFFER_RESPONSE, ) @@ -87,7 +87,7 @@ async def test_get_offer_pdf( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/applicants/{APPLICANT_ID}/offers/{OFFER_ID}/pdf" ), content=GET_PDF_RESPONSE, diff --git a/tests/test_entities/test_applicant_on_vacancy.py b/tests/test_entities/test_applicant_on_vacancy.py index c0575f5..bebdbcd 100644 --- a/tests/test_entities/test_applicant_on_vacancy.py +++ b/tests/test_entities/test_applicant_on_vacancy.py @@ -14,7 +14,7 @@ ApplicantVacancySplitResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ID = 1 @@ -51,7 +51,7 @@ async def test_attach_applicant_to_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", json=ATTACH_APPLICANT_TO_VAC_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -73,7 +73,7 @@ async def test_update_vacancy_status_for_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/vacancy", json=UPDATE_STATUS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -95,7 +95,7 @@ async def test_move_applicant_to_child_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/vacancy/{VACANCY_ID}/split", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/vacancy/{VACANCY_ID}/split", json=MOVE_APPLICANT_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicant_on_vacancy_statuses.py b/tests/test_entities/test_applicant_on_vacancy_statuses.py index 548d70a..cdfe6e9 100644 --- a/tests/test_entities/test_applicant_on_vacancy_statuses.py +++ b/tests/test_entities/test_applicant_on_vacancy_statuses.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.applicant_on_vacancy_status import ApplicantOnVacancyStatus from huntflow_api_client.models.response.applicant_on_vacancy_status import VacancyStatusesResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ON_VAC_STATUS_LIST_RESPONSE: Dict[str, Any] = { @@ -28,7 +28,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/statuses", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/statuses", json=APPLICANT_ON_VAC_STATUS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_applicants.py b/tests/test_entities/test_applicants.py index 6941ae6..1e46cb7 100644 --- a/tests/test_entities/test_applicants.py +++ b/tests/test_entities/test_applicants.py @@ -15,7 +15,7 @@ ApplicantSearchByCursorResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -275,7 +275,7 @@ async def test_list_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants?count=30&page=1", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants?count=30&page=1", json=APPLICANT_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -290,7 +290,7 @@ async def test_get_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", json=APPLICANT_GET_RESPONSE, ) @@ -306,7 +306,7 @@ async def test_create_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants", json=APPLICANT_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -323,7 +323,7 @@ async def test_patch_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", json=APPLICANT_PATCH_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -340,7 +340,7 @@ async def test_delete_applicant( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants" f"/{APPLICANT_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants" f"/{APPLICANT_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -354,7 +354,7 @@ async def test_applicant_search_by_cursor( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" "q=1&&status=1&&rejection_reason=1&&rejection_reason=2&&vacancy=null&&account_source=1" "&&only_current_status=false&&field=all&&count=30", status_code=200, @@ -376,7 +376,7 @@ async def test_applicant_search_by_cursor( ) next_page_cursor = response.next_page_cursor httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/search_by_cursor?" f"next_page_cursor={next_page_cursor}", status_code=200, json=APPLICANT_SEARCH_BY_CURSOR_RESPONSE, diff --git a/tests/test_entities/test_coworkers.py b/tests/test_entities/test_coworkers.py index 20a29d9..de165a8 100644 --- a/tests/test_entities/test_coworkers.py +++ b/tests/test_entities/test_coworkers.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.coworkers import Coworker from huntflow_api_client.models.response.coworkers import CoworkerResponse, CoworkersListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 COWORKER_ID = 2 @@ -72,7 +72,7 @@ async def test_get( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/coworkers/{COWORKER_ID}?vacancy_id={VACANCY_ID}" ), json=GET_COWORKER_RESPONSE, @@ -90,7 +90,7 @@ async def test_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/coworkers?count=30&page=1", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/coworkers?count=30&page=1", json=GET_COWORKER_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_delayed_tasks.py b/tests/test_entities/test_delayed_tasks.py index 1fbb94d..3dbcb88 100644 --- a/tests/test_entities/test_delayed_tasks.py +++ b/tests/test_entities/test_delayed_tasks.py @@ -4,7 +4,7 @@ from huntflow_api_client.entities import DelayedTask from huntflow_api_client.models.response.delayed_tasks import DelayedTaskResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL DELAYED_TASKS_RESPONSE = { "task_id": "1882e199-a310-4000-8706-490f0822fa01", @@ -33,7 +33,7 @@ async def test_get_delayed_task( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/delayed_tasks/{TASK_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/delayed_tasks/{TASK_ID}", json=DELAYED_TASKS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_dictionaries.py b/tests/test_entities/test_dictionaries.py index dd86a5e..fd80585 100644 --- a/tests/test_entities/test_dictionaries.py +++ b/tests/test_entities/test_dictionaries.py @@ -14,7 +14,7 @@ DictionaryTaskResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 DICT_CODE = "dict_code" @@ -102,7 +102,7 @@ async def test_get_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", json=DICT_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -117,7 +117,7 @@ async def test_list_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries", json=DICT_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -132,7 +132,7 @@ async def test_create_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries", json=DICT_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -148,7 +148,7 @@ async def test_update_dictionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/dictionaries/{DICT_CODE}", json=DICT_UPDATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_email_templates.py b/tests/test_entities/test_email_templates.py index 85efa6c..fa49eed 100644 --- a/tests/test_entities/test_email_templates.py +++ b/tests/test_entities/test_email_templates.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import MailTemplate from huntflow_api_client.models.response.email_templates import MailTemplatesResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 TEMPLATE_LIST_RESPONSE: Dict[str, Any] = { @@ -46,7 +46,7 @@ async def test_list_templates( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/mail/templates?editable=false", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/mail/templates?editable=false", json=TEMPLATE_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_file.py b/tests/test_entities/test_file.py index 911a65a..c39bcec 100644 --- a/tests/test_entities/test_file.py +++ b/tests/test_entities/test_file.py @@ -7,7 +7,7 @@ from huntflow_api_client.models.request.file import UploadFileHeaders from huntflow_api_client.models.response.file import UploadResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 UPLOAD_FILE_RESPONSE: Dict[str, Any] = { @@ -43,7 +43,7 @@ async def test_upload_file( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/upload", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/upload", json=UPLOAD_FILE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_multi_vacancies.py b/tests/test_entities/test_multi_vacancies.py index df68d38..60fbe63 100644 --- a/tests/test_entities/test_multi_vacancies.py +++ b/tests/test_entities/test_multi_vacancies.py @@ -15,7 +15,7 @@ ) from huntflow_api_client.models.response.muilti_vacancies import MultiVacancyResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 VACANCY_ID = 2 @@ -27,7 +27,7 @@ async def test_create_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies", json=MULTI_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -47,7 +47,7 @@ async def test_update_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", json=MULTI_VACANCY_RESPONSE, method="PUT", ) @@ -67,7 +67,7 @@ async def test_partial_update_multi_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/multi-vacancies/{VACANCY_ID}", json=MULTI_VACANCY_RESPONSE, method="PATCH", ) diff --git a/tests/test_entities/test_organization_settings.py b/tests/test_entities/test_organization_settings.py index 8c3c037..95887dd 100644 --- a/tests/test_entities/test_organization_settings.py +++ b/tests/test_entities/test_organization_settings.py @@ -10,7 +10,7 @@ HoldReasonsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 SURVEY_ID = 2 @@ -34,7 +34,7 @@ async def test_get_hold_reasons( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_hold_reasons", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_hold_reasons", json=HOLD_REASONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -49,7 +49,7 @@ async def test_get_close_reasons( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_close_reasons", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_close_reasons", json=CLOSE_REASONS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -64,7 +64,7 @@ async def test_get_applicant_survey_form( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_a/{SURVEY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_a/{SURVEY_ID}", json=SURVEY_FORM_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_production_calendar.py b/tests/test_entities/test_production_calendar.py index 1d281a9..6c1eb4f 100644 --- a/tests/test_entities/test_production_calendar.py +++ b/tests/test_entities/test_production_calendar.py @@ -21,7 +21,7 @@ NonWorkingDaysResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 CALENDAR_ID = 1 @@ -64,7 +64,7 @@ async def test_list_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars", + url=f"{VERSIONED_BASE_URL}/production_calendars", json=CALENDAR_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -79,7 +79,7 @@ async def test_get_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}", + url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}", json=CALENDAR_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -94,7 +94,7 @@ async def test_get_organizations_calendar( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/calendar", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/calendar", json=ORG_CALENDAR_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -109,7 +109,7 @@ async def test_get_non_working_days_in_period( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/days/" + url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}/days/" f"{DEADLINE_DATE.strftime('%Y-%m-%d')}?verbose=true", json=NON_WORKING_DAYS_GET_RESPONSE, ) @@ -125,7 +125,7 @@ async def test_get_non_working_days_for_multiple_period( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/days", + url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}/days", json=MULTIPLE_NON_WORKING_DAYS_GET_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -149,7 +149,7 @@ async def test_get_deadline_date_with_non_working_days( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}" + f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}" f"/deadline/{DAYS_COUNT}?start={START_DATE}" ), json=DEADLINE_RESPONSE, @@ -170,7 +170,7 @@ async def test_get_multiple_deadline_dates_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/deadline", + url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}/deadline", json=MULTIPLE_DEADLINE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -196,7 +196,7 @@ async def test_get_start_date_with_non_working_days( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/production_calendars" + f"{VERSIONED_BASE_URL}/production_calendars" f"/{CALENDAR_ID}/start/{DAYS_COUNT}?deadline={DEADLINE_DATE}" ), json=DEADLINE_RESPONSE, @@ -217,7 +217,7 @@ async def test_get_multiple_start_dates_with_non_working_days( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/production_calendars/{CALENDAR_ID}/start", + url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}/start", json=MULTIPLE_START_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_questionary.py b/tests/test_entities/test_questionary.py index 2eed0c9..42c1ffe 100644 --- a/tests/test_entities/test_questionary.py +++ b/tests/test_entities/test_questionary.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import ApplicantsQuestionary from huntflow_api_client.models.response.questionary import QuestionarySchemaResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -51,7 +51,7 @@ async def test_get_schema( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/questionary", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/questionary", json=QUESTIONARY_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -66,7 +66,7 @@ async def test_create_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -82,7 +82,7 @@ async def test_get_applicants_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -97,7 +97,7 @@ async def test_update_questionary( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/questionary", json=QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_regions.py b/tests/test_entities/test_regions.py index 56b852a..40289d1 100644 --- a/tests/test_entities/test_regions.py +++ b/tests/test_entities/test_regions.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.regions import Region from huntflow_api_client.models.response.regions import RegionsListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 REGIONS_LIST_RESPONSE: Dict[str, Any] = { @@ -20,7 +20,7 @@ async def test_regions_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/regions", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/regions", json=REGIONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_rejection_reasons.py b/tests/test_entities/test_rejection_reasons.py index 3504124..5cea543 100644 --- a/tests/test_entities/test_rejection_reasons.py +++ b/tests/test_entities/test_rejection_reasons.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities.rejection_reason import RejectionReason from huntflow_api_client.models.response.rejection_reason import RejectionReasonsListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 REJECTION_REASONS_LIST_RESPONSE: Dict[str, Any] = { @@ -19,7 +19,7 @@ async def test_rejection_reasons_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/rejection_reasons", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/rejection_reasons", json=REJECTION_REASONS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_resume.py b/tests/test_entities/test_resume.py index d26ba0c..eb8bce5 100644 --- a/tests/test_entities/test_resume.py +++ b/tests/test_entities/test_resume.py @@ -13,7 +13,7 @@ ApplicantSourcesResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 APPLICANT_ID = 2 @@ -295,7 +295,7 @@ async def test_get_resume_sources( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/sources", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/sources", json=RESUME_SOURCES_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -311,7 +311,7 @@ async def test_get( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" ), json=APPLICANT_RESUME_RESPONSE, @@ -329,7 +329,7 @@ async def test_delete_resume( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" ), status_code=204, @@ -346,7 +346,7 @@ async def test_update( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/applicants/{APPLICANT_ID}/externals/{EXTERNAL_ID}" ), json=APPLICANT_RESUME_RESPONSE, @@ -368,7 +368,7 @@ async def test_get_resume_pdf( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/" f"externals/{EXTERNAL_ID}/pdf", content=GET_PDF_RESPONSE, ) diff --git a/tests/test_entities/test_survey_type_q.py b/tests/test_entities/test_survey_type_q.py index 355dc87..2972c2f 100644 --- a/tests/test_entities/test_survey_type_q.py +++ b/tests/test_entities/test_survey_type_q.py @@ -10,7 +10,7 @@ SurveySchemaTypeQResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 @@ -166,7 +166,7 @@ async def test_list_schemas( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q?active=true", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q?active=true", json=SURVEY_QUESTIONARY_SCHEMAS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -184,7 +184,7 @@ async def test_get_schema( ) -> None: survey_id = 1 httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/{survey_id}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/{survey_id}", json=SURVEY_QUESTIONARY_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -202,7 +202,7 @@ async def test_create_survey_questionary( ) -> None: request_data = SurveyQuestionaryCreateRequest.model_validate(SURVEY_QUESTIONARY_CREATE_REQUEST) httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/questionaries", json=APPLICANT_SURVEY_QUESTIONARY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -221,7 +221,7 @@ async def test_get_survey_questionary( questionary_id = 1 httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/surveys/type_q/questionaries/{questionary_id}" ), json=APPLICANT_SURVEY_QUESTIONARY_RESPONSE, @@ -242,7 +242,7 @@ async def test_delete_survey_questionary( questionary_id = 1 httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/surveys/type_q/questionaries/{questionary_id}" ), ) @@ -258,7 +258,7 @@ async def test_get_answer( ) -> None: answer_id = 1 httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/surveys/type_q/answers/{answer_id}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_q/answers/{answer_id}", json=SURVEY_QUESTIONARY_ANSWER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_tags.py b/tests/test_entities/test_tags.py index f56cd8f..e4bbb28 100644 --- a/tests/test_entities/test_tags.py +++ b/tests/test_entities/test_tags.py @@ -14,7 +14,7 @@ ApplicantTagsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 TAG_ID = 2 @@ -40,7 +40,7 @@ async def test_get_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -55,7 +55,7 @@ async def test_create_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/tags", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -72,7 +72,7 @@ async def test_update_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", json=ACCOUNT_TAG_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -89,7 +89,7 @@ async def test_delete_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/tags/{TAG_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -104,7 +104,7 @@ async def test_list_account_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/tags", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/tags", json=ACCOUNT_TAGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -119,7 +119,7 @@ async def test_list_applicant_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", json=APPLICANT_TAGS_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -134,7 +134,7 @@ async def test_update_applicant_tag( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/tags", json=APPLICANT_TAGS_UPDATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_user_settings.py b/tests/test_entities/test_user_settings.py index 7b624c5..8fe693c 100644 --- a/tests/test_entities/test_user_settings.py +++ b/tests/test_entities/test_user_settings.py @@ -9,7 +9,7 @@ EmailAccountsListResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL GET_USER_EMAIL_ACCOUNTS_RESPONSE: Dict[str, Any] = { "items": [ @@ -49,7 +49,7 @@ async def test_get_email_accounts( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/email_accounts", + url=f"{VERSIONED_BASE_URL}/email_accounts", json=GET_USER_EMAIL_ACCOUNTS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -64,7 +64,7 @@ async def test_get_calendar_accounts( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/calendar_accounts", + url=f"{VERSIONED_BASE_URL}/calendar_accounts", json=GET_USER_CALENDAR_ACCOUNTS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_users.py b/tests/test_entities/test_users.py index 8ae76b8..17ac6e4 100644 --- a/tests/test_entities/test_users.py +++ b/tests/test_entities/test_users.py @@ -6,7 +6,7 @@ from huntflow_api_client.entities import User from huntflow_api_client.models.response.users import UserResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 USER_ID = 2 @@ -27,7 +27,7 @@ async def test_get_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/{USER_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/{USER_ID}", json=GET_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_users_management.py b/tests/test_entities/test_users_management.py index 3a08202..7340819 100644 --- a/tests/test_entities/test_users_management.py +++ b/tests/test_entities/test_users_management.py @@ -14,7 +14,7 @@ UserInternalIDResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 FOREIGN_USER_ID = "some_foreign_id" @@ -75,7 +75,7 @@ async def test_get_users_with_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign?count=30&page=1", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign?count=30&page=1", json=GET_USERS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -90,7 +90,7 @@ async def test_get_user_by_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", json=GET_USER_BY_FOREIGN_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -108,7 +108,7 @@ async def test_get_user_control_task( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/task/{TASK_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/task/{TASK_ID}", json=GET_USER_CONTROL_TASK_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -123,7 +123,7 @@ async def test_get_user_internal_id_by_foreign( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}/id", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}/id", json=GET_USER_ID_BY_FOREIGN_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -141,7 +141,7 @@ async def test_delete_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", status_code=202, json=CREATE_USER_TASK_RESPONSE, ) @@ -157,7 +157,7 @@ async def test_create_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign", json=CREATE_USER_TASK_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -177,7 +177,7 @@ async def test_update_user( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/foreign/{FOREIGN_USER_ID}", json=UPDATE_USER_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_vacancies.py b/tests/test_entities/test_vacancies.py index 04a1dfd..f018abd 100644 --- a/tests/test_entities/test_vacancies.py +++ b/tests/test_entities/test_vacancies.py @@ -27,7 +27,7 @@ VacancyStatusGroupsResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 VACANCY_ID = 2 @@ -277,7 +277,7 @@ async def test_get_get_org_vacancy_additional_fields_schema( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/additional_fields", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/additional_fields", json=GET_ORG_ADD_FIELDS_SCHEMA_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -292,7 +292,7 @@ async def test_list_vacancies( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies?" + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies?" f"count=30&page=1&mine=false&state=OPEN&state=HOLD", json=GET_LIST_VACANCIES_RESPONSE, ) @@ -309,7 +309,7 @@ async def test_get_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=GET_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -324,7 +324,7 @@ async def test_create_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies", json=CREATE_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -348,7 +348,7 @@ async def test_update_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=UPDATE_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -368,7 +368,7 @@ async def test_delete_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", status_code=204, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -382,7 +382,7 @@ async def test_patch_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}", json=PATCH_VACANCY_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -401,7 +401,7 @@ async def test_assign_coworker( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/vacancies/{VACANCY_ID}/members/{COWORKER_ID}" ), json=ASSIGN_COWORKER_RESPONSE, @@ -420,7 +420,7 @@ async def test_remove_coworker( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/vacancies/{VACANCY_ID}/members/{COWORKER_ID}" ), status_code=204, @@ -436,7 +436,7 @@ async def test_vacancy_frames_list( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frames", json=VACANCY_FRAME_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -451,7 +451,7 @@ async def test_get_last_vacancy_frame( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frame", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/frame", json=LAST_VACANCY_FRAME_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -467,7 +467,7 @@ async def test_get_vacancy_quotas_in_frame( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/vacancies/{VACANCY_ID}/frames/{FRAME_ID}/quotas" ), json=VACANCY_QUOTAS_IN_FRAME_RESPONSE, @@ -485,7 +485,7 @@ async def test_get_vacancy_quota_list( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/vacancies/{VACANCY_ID}/quotas?count=2&page=1" ), json=VACANCY_QUOTAS_RESPONSE, @@ -502,7 +502,7 @@ async def test_get_vacancy_status_groups( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/status_groups", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/status_groups", json=VACANCY_STATUS_GROUPS_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -517,7 +517,7 @@ async def test_close_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/close", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/close", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) @@ -531,7 +531,7 @@ async def test_hold_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/hold", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/hold", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) @@ -545,7 +545,7 @@ async def test_resume_vacancy( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/resume", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancies/{VACANCY_ID}/state/resume", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) vacancies = Vacancy(api_client) diff --git a/tests/test_entities/test_vacancy_request.py b/tests/test_entities/test_vacancy_request.py index 0bc9cf5..b096365 100644 --- a/tests/test_entities/test_vacancy_request.py +++ b/tests/test_entities/test_vacancy_request.py @@ -8,7 +8,7 @@ VacancyRequestResponse, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 @@ -83,7 +83,7 @@ async def test_list_vacancy_request( ) -> None: httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}" f"/vacancy_requests?page=1&&count=30&&values=false" ), json=VACANCY_REQUEST_LIST_WITHOUT_VALUES, @@ -98,7 +98,7 @@ async def test_list_vacancy_request( httpx_mock.add_response( url=( - f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests?" + f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests?" f"vacancy_id=1&&page=1&&count=30&&values=true" ), json=VACANCY_REQUEST_LIST_WITH_VALUES, @@ -113,7 +113,7 @@ async def test_get_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests/1", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests/1", json=VACANCY_REQUEST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -129,7 +129,7 @@ async def test_create_vacancy_request( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/vacancy_requests", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/vacancy_requests", json=VACANCY_REQUEST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) diff --git a/tests/test_entities/test_webhooks.py b/tests/test_entities/test_webhooks.py index e1de919..3dee175 100644 --- a/tests/test_entities/test_webhooks.py +++ b/tests/test_entities/test_webhooks.py @@ -8,7 +8,7 @@ from huntflow_api_client.models.request.webhooks import WebhookRequest from huntflow_api_client.models.response.webhooks import WebhookResponse, WebhooksListResponse from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL ACCOUNT_ID = 1 HOOK_ID = 2 @@ -41,7 +41,7 @@ async def test_list_webhooks( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/hooks", json=WEBHOOK_LIST_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -56,7 +56,7 @@ async def test_create_webhook( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/hooks", json=WEBHOOK_CREATE_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) @@ -77,7 +77,7 @@ async def test_delete_webhook( token_proxy: HuntflowTokenProxy, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/{ACCOUNT_ID}/hooks/{HOOK_ID}", + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/hooks/{HOOK_ID}", ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) webhooks = Webhook(api_client) diff --git a/tests/test_errors/test_error_handlers.py b/tests/test_errors/test_error_handlers.py index ffa19c6..6f6c4e7 100644 --- a/tests/test_errors/test_error_handlers.py +++ b/tests/test_errors/test_error_handlers.py @@ -15,7 +15,7 @@ TooManyRequestsError, ) from huntflow_api_client.tokens.proxy import HuntflowTokenProxy -from tests.api import BASE_URL, BASE_URL_WITH_VERSION +from tests.api import BASE_URL, VERSIONED_BASE_URL @pytest.fixture() @@ -24,7 +24,7 @@ def api_client(token_proxy: HuntflowTokenProxy) -> HuntflowAPI: class TestErrorHandler401: - url = f"{BASE_URL_WITH_VERSION}/me" + url = f"{VERSIONED_BASE_URL}/me" async def test_authorization_error( self, @@ -90,7 +90,7 @@ async def test_token_expired_error( class TestErrorHandler400: - url = f"{BASE_URL_WITH_VERSION}/accounts/11/vacancies" + url = f"{VERSIONED_BASE_URL}/accounts/11/vacancies" async def test_bad_request_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response( @@ -131,7 +131,7 @@ async def test_bad_request_error(self, httpx_mock: HTTPXMock, api_client: Huntfl class TestErrorHandler402: - url = f"{BASE_URL_WITH_VERSION}/me" + url = f"{VERSIONED_BASE_URL}/me" async def test_payment_required_error( self, @@ -152,7 +152,7 @@ async def test_payment_required_error( class TestErrorHandler403: - url = f"{BASE_URL_WITH_VERSION}/me" + url = f"{VERSIONED_BASE_URL}/me" async def test_access_denied_error( self, @@ -175,7 +175,7 @@ async def test_access_denied_error( class TestErrorHandler404: async def test_not_found_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/accounts/11/vacancy_requests/0", + url=f"{VERSIONED_BASE_URL}/accounts/11/vacancy_requests/0", method="GET", status_code=404, json={"errors": [{"type": "not_found", "title": "Unknown vacancy request"}]}, @@ -192,7 +192,7 @@ async def test_invalid_refresh_token_error( api_client: HuntflowAPI, ) -> None: httpx_mock.add_response( - url=f"{BASE_URL_WITH_VERSION}/token/refresh", + url=f"{VERSIONED_BASE_URL}/token/refresh", method="POST", status_code=404, json={"errors": [{"type": "not_found", "title": "error.robot_token.not_found"}]}, @@ -205,7 +205,7 @@ async def test_invalid_refresh_token_error( class TestErrorHandler429: - url = f"{BASE_URL_WITH_VERSION}/me" + url = f"{VERSIONED_BASE_URL}/me" async def test_too_many_requests_error( self, @@ -235,7 +235,7 @@ async def test_too_many_requests_error( class TestDefaultErrorHandler: - url = f"{BASE_URL_WITH_VERSION}/me" + url = f"{VERSIONED_BASE_URL}/me" async def test_api_error(self, httpx_mock: HTTPXMock, api_client: HuntflowAPI) -> None: httpx_mock.add_response(