Skip to content

Commit 3c8bd46

Browse files
committed
fix: move packages config to [tool.poetry] section and fix test UUID handling
- Move packages configuration from [project] to [tool.poetry] section to fix poetry install failure when using setuptools as build backend - Fix UUID type handling in test fixtures (live_video, motion_capture, workflow_runs) - Add restore_test_applicant fixture to prevent test failures from deleted applicants - Fix document_id assertion to compare string representation in task tests
1 parent 14c2fc6 commit 3c8bd46

5 files changed

Lines changed: 21 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ authors = [
88
license = { text = "MIT" }
99
readme = "README.md"
1010
keywords = ["OpenAPI", "OpenAPI-Generator", "onfido", "identity"]
11-
packages = [
12-
{ include = "onfido" }
13-
]
1411
requires-python = ">=3.9"
1512

1613
dependencies = [
@@ -26,6 +23,9 @@ Repository = "https://github.com/onfido/onfido-python"
2623

2724
[tool.poetry]
2825
requires-poetry = ">=2.0"
26+
packages = [
27+
{ include = "onfido" }
28+
]
2929

3030
[tool.poetry.group.dev.dependencies]
3131
pytest = ">= 7.2.1"

tests/test_live_video.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
from onfido import ApiException, LiveVideo, LiveVideosList
44
from os import environ
5+
from uuid import UUID
6+
7+
8+
@pytest.fixture(scope="module", autouse=True)
9+
def restore_test_applicant(onfido_api):
10+
"""Restore the test applicant before running live video tests in case it's scheduled for deletion."""
11+
try:
12+
onfido_api.restore_applicant(environ["ONFIDO_SAMPLE_APPLICANT_ID"])
13+
except ApiException:
14+
# Applicant may not be deleted, ignore the error
15+
pass
516

617

718
@pytest.fixture(scope="function")
@@ -11,7 +22,7 @@ def applicant_id(onfido_api):
1122

1223
@pytest.fixture(scope="function")
1324
def live_video_id(onfido_api):
14-
return environ["ONFIDO_SAMPLE_VIDEO_ID_1"]
25+
return UUID(environ["ONFIDO_SAMPLE_VIDEO_ID_1"])
1526

1627

1728
def test_list_live_videos(onfido_api, applicant_id):

tests/test_motion_capture.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from onfido import ApiException, MotionCapture, MotionCapturesList
44
from os import environ
5+
from uuid import UUID
56

67

78
@pytest.fixture(scope="function")
@@ -11,7 +12,7 @@ def applicant_id(onfido_api):
1112

1213
@pytest.fixture(scope="function")
1314
def motion_id(onfido_api):
14-
return environ["ONFIDO_SAMPLE_MOTION_ID_1"]
15+
return UUID(environ["ONFIDO_SAMPLE_MOTION_ID_1"])
1516

1617

1718
def test_list_motion_captures(onfido_api, applicant_id):

tests/test_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@ def test_complete_task(onfido_api, workflow_run_id, document_id):
8686
workflow_run_id,
8787
document_photo_task_id).output
8888

89-
assert document_photo_task_outputs == [{"id": document_id,
89+
assert document_photo_task_outputs == [{"id": str(document_id),
9090
"type": "document"}]

tests/test_workflow_runs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import zipfile
33
import pytest
44

5+
from uuid import UUID
56
from onfido import (
67
TimelineFileReference,
78
WorkflowRun,
@@ -23,7 +24,7 @@ def applicant_id(onfido_api):
2324

2425
@pytest.fixture(scope="function")
2526
def workflow_id():
26-
return "e8c921eb-0495-44fe-b655-bcdcaffdafe5"
27+
return UUID("e8c921eb-0495-44fe-b655-bcdcaffdafe5")
2728

2829

2930
@pytest.fixture(scope="function")
@@ -41,7 +42,7 @@ def test_create_workflow_run(workflow_run, workflow_id):
4142

4243

4344
def test_create_workflow_run_with_custom_inputs(onfido_api, applicant_id):
44-
workflow_id = "45092b29-f220-479e-aa6f-a6f989baac4c"
45+
workflow_id = UUID("45092b29-f220-479e-aa6f-a6f989baac4c")
4546

4647
workflow_run_builder = WorkflowRunBuilder(
4748
applicant_id=applicant_id,

0 commit comments

Comments
 (0)