Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def create_workflow_run(


def repeat_request_until_status_changes(
function, params, status, max_retries=10, sleep_time=1
function, params, status, max_retries=15, sleep_time=1
):
instance = function(*params)

Expand All @@ -138,7 +138,7 @@ def repeat_request_until_status_changes(


def repeat_request_until_task_output_changes(
function, params, max_retries=10, sleep_time=1
function, params, max_retries=15, sleep_time=1
):
instance = function(*params)

Expand All @@ -156,7 +156,7 @@ def repeat_request_until_task_output_changes(


def repeat_request_until_http_code_changes(
function, params, max_retries=10, sleep_time=1
function, params, max_retries=15, sleep_time=1
):
iteration = 0
while iteration <= max_retries:
Expand Down
15 changes: 12 additions & 3 deletions tests/test_reports.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import pytest

from onfido import Report, ReportName, ReportStatus
from tests.conftest import create_applicant, create_check, upload_document
from tests.conftest import (
create_applicant,
create_check,
upload_document,
repeat_request_until_status_changes,
)
from typing import List


Expand Down Expand Up @@ -51,13 +56,17 @@ def test_list_reports(sorted_reports):


def test_find_report(onfido_api, document_report_id, identity_report_id):
get_document_report = onfido_api.find_report(document_report_id)
get_document_report = Report(
repeat_request_until_status_changes(
onfido_api.find_report, [document_report_id], ReportStatus.COMPLETE
)
)
get_identity_report = onfido_api.find_report(identity_report_id)

assert isinstance(get_document_report, Report)
assert get_document_report.actual_instance.id == document_report_id
assert get_document_report.actual_instance.name == ReportName.DOCUMENT
assert get_document_report.actual_instance.status == ReportStatus.AWAITING_DATA
assert get_document_report.actual_instance.status == ReportStatus.COMPLETE

assert isinstance(get_identity_report, Report)
assert get_identity_report.actual_instance.id == identity_report_id
Expand Down
11 changes: 9 additions & 2 deletions tests/test_workflow_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import zipfile
import pytest

from onfido import TimelineFileReference, WorkflowRun, WorkflowRunBuilder, WorkflowRunStatus
from onfido import (
TimelineFileReference,
WorkflowRun,
WorkflowRunBuilder,
WorkflowRunStatus,
)
from tests.conftest import (
create_applicant,
create_workflow_run,
Expand Down Expand Up @@ -81,7 +86,9 @@ def test_download_evidence_folder(onfido_api, applicant_id):
onfido_api.find_workflow_run, [workflow_run_id], WorkflowRunStatus.APPROVED
)

file = onfido_api.download_evidence_folder(workflow_run_id)
file = repeat_request_until_http_code_changes(
onfido_api.download_evidence_folder, [workflow_run_id]
)

assert len(file) > 0
with tempfile.NamedTemporaryFile() as tmp_file:
Expand Down
Loading