|
3 | 3 | from huntflow_api_client import HuntflowAPI |
4 | 4 | from huntflow_api_client.entities.survey_type_a import SurveyTypeA |
5 | 5 | from huntflow_api_client.models.response.survey import ( |
| 6 | + SurveyAnswerTypeAResponse, |
6 | 7 | SurveySchemasTypeAListResponse, |
7 | 8 | SurveySchemaTypeAResponse, |
8 | 9 | ) |
|
35 | 36 | "ui_schema": {}, |
36 | 37 | } |
37 | 38 |
|
| 39 | +SURVEY_ANSWER_RESPONSE = { |
| 40 | + "id": 1, |
| 41 | + "created": "2020-01-01T00:00:00+03:00", |
| 42 | + "survey": { |
| 43 | + "id": 1, |
| 44 | + "name": "test_survey", |
| 45 | + "type": "type_a", |
| 46 | + "active": True, |
| 47 | + "created": "2020-01-01T00:00:00+03:00", |
| 48 | + "updated": "2020-01-01T00:00:00+03:00", |
| 49 | + "schema": {}, |
| 50 | + "ui_schema": {}, |
| 51 | + }, |
| 52 | + "respondent": {"account_id": 1, "name": "John Joe"}, |
| 53 | + "data": {}, |
| 54 | +} |
| 55 | + |
38 | 56 |
|
39 | 57 | async def test_list( |
40 | 58 | httpx_mock: HTTPXMock, |
@@ -69,3 +87,23 @@ async def test_get( |
69 | 87 | assert response == SurveySchemaTypeAResponse.model_validate( |
70 | 88 | SURVEY_FEEDBACK_SCHEMA_RESPONSE, |
71 | 89 | ) |
| 90 | + |
| 91 | + |
| 92 | +async def test_get_applicant_answer( |
| 93 | + httpx_mock: HTTPXMock, |
| 94 | + token_proxy: HuntflowTokenProxy, |
| 95 | +) -> None: |
| 96 | + survey_id = 1 |
| 97 | + answer_id = 2 |
| 98 | + httpx_mock.add_response( |
| 99 | + url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/surveys/type_a/" |
| 100 | + f"{survey_id}/answers/{answer_id}", |
| 101 | + json=SURVEY_ANSWER_RESPONSE, |
| 102 | + ) |
| 103 | + api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy) |
| 104 | + feedback = SurveyTypeA(api_client) |
| 105 | + |
| 106 | + response = await feedback.get_applicant_answer(ACCOUNT_ID, survey_id, answer_id) |
| 107 | + assert response == SurveyAnswerTypeAResponse.model_validate( |
| 108 | + SURVEY_ANSWER_RESPONSE, |
| 109 | + ) |
0 commit comments