Skip to content

Commit e52b149

Browse files
authored
Merge pull request #186 from getyoti/hotfix-2.11.1
Hotfix 2.11.1
2 parents ec94e79 + 145edfd commit e52b149

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[run]
22
omit =
3+
yoti_python_sdk/version.py
34
yoti_python_sdk/tests/**
45
yoti_python_sdk/protobuf/**/*
56
examples/**

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sonar.host.url = https://sonarcloud.io
22
sonar.organization = getyoti
33
sonar.projectKey = getyoti:python
44
sonar.projectName = Python SDK
5-
sonar.projectVersion = 2.11.0
5+
sonar.projectVersion = 2.11.1
66
sonar.exclusions = yoti_python_sdk/tests/**,examples/**,yoti_python_sdk/protobuf/**/*
77

88
sonar.python.pylint.reportPath = coverage.out

yoti_python_sdk/doc_scan/session/retrieve/id_document_resource_response.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
DocumentFieldsResponse,
66
)
77
from yoti_python_sdk.doc_scan.session.retrieve.page_response import PageResponse
8-
from yoti_python_sdk.doc_scan.session.retrieve.task_response import TaskResponse
8+
from yoti_python_sdk.doc_scan.session.retrieve.resource_response import ResourceResponse
99

1010

11-
class IdDocumentResourceResponse(object):
11+
class IdDocumentResourceResponse(ResourceResponse):
1212
"""
1313
Represents an Identity Document resource for a given session
1414
"""
@@ -21,37 +21,17 @@ def __init__(self, data=None):
2121
if data is None:
2222
data = dict()
2323

24-
self.__id = data.get("id", None)
24+
ResourceResponse.__init__(self, data)
25+
2526
self.__document_type = data.get("document_type", None)
2627
self.__issuing_country = data.get("issuing_country", None)
27-
self.__tasks = [TaskResponse(task) for task in data.get("tasks", [])]
2828
self.__pages = [PageResponse(page) for page in data.get("pages", [])]
2929
self.__document_fields = (
3030
DocumentFieldsResponse(data["document_fields"])
3131
if "document_fields" in data.keys()
3232
else None
3333
)
3434

35-
@property
36-
def id(self):
37-
"""
38-
Returns the ID of the identity document
39-
40-
:return: the ID
41-
:rtype: str or None
42-
"""
43-
return self.__id
44-
45-
@property
46-
def tasks(self):
47-
"""
48-
Returns all associated tasks of the identity document
49-
50-
:return: the associated tasks
51-
:rtype: list[TaskResponse]
52-
"""
53-
return self.__tasks
54-
5535
@property
5636
def document_type(self):
5737
"""

yoti_python_sdk/tests/doc_scan/session/retrieve/test_id_document_resource_response.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
66
from yoti_python_sdk.doc_scan.session.retrieve.id_document_resource_response import (
77
IdDocumentResourceResponse,
88
)
9+
from yoti_python_sdk.doc_scan.session.retrieve.task_response import (
10+
TextExtractionTaskResponse,
11+
TaskResponse,
12+
)
913

1014

1115
class IdDocumentResourceResponseTest(unittest.TestCase):
1216
SOME_ID = "someId"
1317
SOME_DOCUMENT_TYPE = "someDocumentType"
1418
SOME_ISSUING_COUNTRY = "someIssuingCountry"
15-
SOME_TASKS = [{"first": "task"}, {"second": "task"}]
19+
SOME_TASKS = [
20+
{"first": "task", "type": "ID_DOCUMENT_TEXT_DATA_EXTRACTION"},
21+
{"second": "task"},
22+
]
1623
SOME_PAGES = [{"first": "page"}, {"second": "page"}]
1724
SOME_DOCUMENT_FIELDS = {"media": {}}
1825

@@ -28,9 +35,9 @@ def test_should_parse_correctly(self):
2835

2936
result = IdDocumentResourceResponse(data)
3037

31-
assert result.id is self.SOME_ID
32-
assert result.document_type is self.SOME_DOCUMENT_TYPE
33-
assert result.issuing_country is self.SOME_ISSUING_COUNTRY
38+
assert result.id == self.SOME_ID
39+
assert result.document_type == self.SOME_DOCUMENT_TYPE
40+
assert result.issuing_country == self.SOME_ISSUING_COUNTRY
3441
assert len(result.tasks) == 2
3542
assert len(result.pages) == 2
3643
assert isinstance(result.document_fields, DocumentFieldsResponse)
@@ -45,6 +52,22 @@ def test_should_parse_when_none(self):
4552
assert len(result.pages) == 0
4653
assert result.document_fields is None
4754

55+
def test_should_parse_tasks_with_type(self):
56+
data = {
57+
"id": self.SOME_ID,
58+
"document_type": self.SOME_DOCUMENT_TYPE,
59+
"issuing_country": self.SOME_ISSUING_COUNTRY,
60+
"tasks": self.SOME_TASKS,
61+
"pages": self.SOME_PAGES,
62+
"document_fields": self.SOME_DOCUMENT_FIELDS,
63+
}
64+
65+
result = IdDocumentResourceResponse(data)
66+
67+
assert len(result.tasks) == 2
68+
assert isinstance(result.tasks[0], TextExtractionTaskResponse)
69+
assert isinstance(result.tasks[1], TaskResponse)
70+
4871

4972
if __name__ == "__main__":
5073
unittest.main()

yoti_python_sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = "2.11.0"
2+
__version__ = "2.11.1"

0 commit comments

Comments
 (0)