diff --git a/tests/conftest.py b/tests/conftest.py index e1a34ee..4434b4e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -60,7 +60,7 @@ def create_applicant(onfido_api, applicant_builder=None): def upload_document(onfido_api, applicant_id): return onfido_api.upload_document( applicant_id=applicant_id, - type="passport", + type=onfido.DocumentTypes.PASSPORT, side="front", file="tests/media/sample_driving_licence.png", ) @@ -142,13 +142,13 @@ def repeat_request_until_task_output_changes( instance = function(*params) iteration = 0 - while instance.output == None: + while instance.output is None: if iteration > max_retries: pytest.fail("Task output did not change in time") iteration += 1 sleep(sleep_time) - + instance = function(*params) return instance diff --git a/tests/test_documents.py b/tests/test_documents.py index 934102b..1696f87 100644 --- a/tests/test_documents.py +++ b/tests/test_documents.py @@ -1,6 +1,6 @@ import pytest -from onfido import ApiException, Document, DocumentsList +from onfido import ApiException, Document, DocumentsList, DocumentTypes from tests.conftest import create_applicant, upload_document @@ -17,7 +17,7 @@ def document(onfido_api, applicant_id): def test_create_document(applicant_id, document): assert document is not None assert document.applicant_id == applicant_id - assert document.type == "passport" + assert document.type == DocumentTypes.PASSPORT assert document.side == "front" assert isinstance(document, Document) diff --git a/tests/test_qualified_electronic_signatures.py b/tests/test_qualified_electronic_signatures.py index 44d9c85..5fad1fc 100644 --- a/tests/test_qualified_electronic_signatures.py +++ b/tests/test_qualified_electronic_signatures.py @@ -41,8 +41,7 @@ def workflow_run(onfido_api, applicant_id, workflow_id): @pytest.fixture(scope="function") def file_id(onfido_api, workflow_run): - - task = onfido_api.list_tasks(workflow_run.id)[0] + task = onfido_api.list_tasks(workflow_run.id)[1] output = repeat_request_until_task_output_changes( onfido_api.find_task, [workflow_run.id, task.id], max_retries=10, sleep_time=3 diff --git a/tests/test_webhook_verification.py b/tests/test_webhook_verification.py index d11f5fc..b4d538a 100644 --- a/tests/test_webhook_verification.py +++ b/tests/test_webhook_verification.py @@ -1,5 +1,8 @@ from onfido.webhook_event_verifier import WebhookEventVerifier, OnfidoInvalidSignatureError -from onfido import WebhookEvent, WebhookEventPayload, WebhookEventPayloadObject +from onfido import ( + WebhookEvent, WebhookEventPayload, WebhookEventPayloadObject, + WebhookEventResourceType, WebhookEventType, WebhookEventObjectStatus +) import pytest @@ -12,12 +15,12 @@ expected_event = WebhookEvent( payload=WebhookEventPayload( - action="check.completed", - resource_type="check", + action=WebhookEventType.CHECK_DOT_COMPLETED, + resource_type=WebhookEventResourceType.CHECK, object=WebhookEventPayloadObject( id='f2302f45-227d-413d-ad61-09ec077a086a', href='https://api.onfido.com/v3.6/checks/f2302f45-227d-413d-ad61-09ec077a086a', - status="complete", + status=WebhookEventObjectStatus.COMPLETE, completed_at_iso8601='2024-04-04T09:21:21Z' ) )