Skip to content

Commit 16eae0a

Browse files
committed
SDK-894: Update UNDEFINED ContentType handling
1 parent 7bb64e8 commit 16eae0a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

yoti_python_sdk/protobuf/protobuf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def anchor(data):
4343
return anchor
4444

4545
def value_based_on_content_type(self, value, content_type=None):
46-
if content_type == self.CT_UNDEFINED:
47-
raise TypeError('Wrong content type')
48-
elif content_type == self.CT_STRING:
46+
if content_type == self.CT_STRING:
4947
return value.decode('utf-8')
5048
elif content_type == self.CT_DATE:
5149
return value.decode('utf-8')

yoti_python_sdk/tests/test_protobuf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def test_protobuf_value_based_on_content_type(proto):
1414
byte_value = str.encode(string_value)
1515
int_value = int(string_value)
1616

17-
with pytest.raises(TypeError):
18-
proto.value_based_on_content_type(byte_value, proto.CT_UNDEFINED)
17+
result = proto.value_based_on_content_type(byte_value, proto.CT_UNDEFINED)
18+
assert result == string_value
1919

2020
result = proto.value_based_on_content_type(byte_value, proto.CT_STRING)
2121
assert result == string_value

0 commit comments

Comments
 (0)