|
9 | 9 | ApplicantUpdateRequest, |
10 | 10 | ) |
11 | 11 | from huntflow_api_client.models.response.applicants import ( |
| 12 | + ApplicantCreateAgreementLinkResponse, |
12 | 13 | ApplicantCreateResponse, |
13 | 14 | ApplicantItem, |
14 | 15 | ApplicantListResponse, |
15 | 16 | ApplicantSearchByCursorResponse, |
| 17 | + ApplicantSendAgreementResponse, |
16 | 18 | ) |
17 | 19 | from huntflow_api_client.tokens.proxy import HuntflowTokenProxy |
18 | 20 | from tests.api import BASE_URL, VERSIONED_BASE_URL |
|
269 | 271 | "next_page_cursor": "3VudCI6IjoXIjogW10IiwgMy4wXX0=", |
270 | 272 | } |
271 | 273 |
|
| 274 | +APPLICANT_CREATE_AGREEMENT_RESPONSE: Dict[str, Any] = {"link": "https://agreement.example/1"} |
| 275 | +APPLICANT_SEND_AGREEMENT_RESPONSE: Dict[str, Any] = { |
| 276 | + "sent_to": "user@example.com", |
| 277 | + "job_id": "job-id-1111", |
| 278 | +} |
| 279 | + |
272 | 280 |
|
273 | 281 | async def test_list_applicant( |
274 | 282 | httpx_mock: HTTPXMock, |
@@ -385,3 +393,35 @@ async def test_applicant_search_by_cursor( |
385 | 393 | assert response == ApplicantSearchByCursorResponse.model_validate( |
386 | 394 | APPLICANT_SEARCH_BY_CURSOR_RESPONSE, |
387 | 395 | ) |
| 396 | + |
| 397 | + |
| 398 | +async def test_create_agreement_link( |
| 399 | + httpx_mock: HTTPXMock, |
| 400 | + token_proxy: HuntflowTokenProxy, |
| 401 | +) -> None: |
| 402 | + httpx_mock.add_response( |
| 403 | + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/agreement_link", |
| 404 | + json=APPLICANT_CREATE_AGREEMENT_RESPONSE, |
| 405 | + ) |
| 406 | + api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) |
| 407 | + |
| 408 | + applicants = Applicant(api_client) |
| 409 | + |
| 410 | + response = await applicants.create_agreement_link(ACCOUNT_ID, APPLICANT_ID) |
| 411 | + assert response == ApplicantCreateAgreementLinkResponse(**APPLICANT_CREATE_AGREEMENT_RESPONSE) |
| 412 | + |
| 413 | + |
| 414 | +async def test_send_agreement_via_email( |
| 415 | + httpx_mock: HTTPXMock, |
| 416 | + token_proxy: HuntflowTokenProxy, |
| 417 | +) -> None: |
| 418 | + httpx_mock.add_response( |
| 419 | + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}/agreement_email", |
| 420 | + json=APPLICANT_SEND_AGREEMENT_RESPONSE, |
| 421 | + ) |
| 422 | + api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) |
| 423 | + |
| 424 | + applicants = Applicant(api_client) |
| 425 | + |
| 426 | + response = await applicants.send_agreement_via_email(ACCOUNT_ID, APPLICANT_ID) |
| 427 | + assert response == ApplicantSendAgreementResponse(**APPLICANT_SEND_AGREEMENT_RESPONSE) |
0 commit comments