Skip to content

Commit ea9987b

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

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

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: 12 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,17 @@ 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 = Report(
60+
repeat_request_until_status_changes(
61+
onfido_api.find_report, [document_report_id], ReportStatus.COMPLETE
62+
)
63+
)
5564
get_identity_report = onfido_api.find_report(identity_report_id)
5665

5766
assert isinstance(get_document_report, Report)
5867
assert get_document_report.actual_instance.id == document_report_id
5968
assert get_document_report.actual_instance.name == ReportName.DOCUMENT
60-
assert get_document_report.actual_instance.status == ReportStatus.AWAITING_DATA
69+
assert get_document_report.actual_instance.status == ReportStatus.COMPLETE
6170

6271
assert isinstance(get_identity_report, Report)
6372
assert get_identity_report.actual_instance.id == identity_report_id

0 commit comments

Comments
 (0)