Skip to content

Commit 5f682fc

Browse files
test: increase number of retries until expected change happens
1 parent d8c04e1 commit 5f682fc

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def create_workflow_run(
114114

115115

116116
def repeat_request_until_status_changes(
117-
function, params, status, max_retries=10, sleep_time=1
117+
function, params, status, max_retries=15, sleep_time=1
118118
):
119119
instance = function(*params)
120120

@@ -138,7 +138,7 @@ def repeat_request_until_status_changes(
138138

139139

140140
def repeat_request_until_task_output_changes(
141-
function, params, max_retries=10, sleep_time=1
141+
function, params, max_retries=15, sleep_time=1
142142
):
143143
instance = function(*params)
144144

@@ -156,7 +156,7 @@ def repeat_request_until_task_output_changes(
156156

157157

158158
def repeat_request_until_http_code_changes(
159-
function, params, max_retries=10, sleep_time=1
159+
function, params, max_retries=15, sleep_time=1
160160
):
161161
iteration = 0
162162
while iteration <= max_retries:

tests/test_reports.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import pytest
22

33
from onfido import Report, ReportName, ReportStatus
4-
from tests.conftest import create_applicant, create_check, upload_document
4+
from tests.conftest import (
5+
create_applicant,
6+
create_check,
7+
upload_document,
8+
repeat_request_until_status_changes,
9+
)
510
from typing import List
611

712

@@ -51,13 +56,15 @@ def test_list_reports(sorted_reports):
5156

5257

5358
def test_find_report(onfido_api, document_report_id, identity_report_id):
54-
get_document_report = onfido_api.find_report(document_report_id)
59+
get_document_report = repeat_request_until_status_changes(
60+
onfido_api.find_report, [document_report_id], ReportStatus.COMPLETE
61+
)
5562
get_identity_report = onfido_api.find_report(identity_report_id)
5663

5764
assert isinstance(get_document_report, Report)
5865
assert get_document_report.actual_instance.id == document_report_id
5966
assert get_document_report.actual_instance.name == ReportName.DOCUMENT
60-
assert get_document_report.actual_instance.status == ReportStatus.AWAITING_DATA
67+
assert get_document_report.actual_instance.status == ReportStatus.COMPLETE
6168

6269
assert isinstance(get_identity_report, Report)
6370
assert get_identity_report.actual_instance.id == identity_report_id

0 commit comments

Comments
 (0)