1
1
# -*- coding: utf-8 -*-
2
2
from __future__ import unicode_literals
3
3
4
- import pytest
5
-
6
4
from os import environ
5
+
6
+ import pytest
7
7
from past .builtins import basestring
8
8
9
9
try :
12
12
import mock
13
13
14
14
from yoti import YOTI_API_ENDPOINT
15
- from yoti .client import Client , NO_KEY_FILE_SPECIFIED_ERROR
15
+ from yoti import Client
16
+ from yoti .client import NO_KEY_FILE_SPECIFIED_ERROR
16
17
from yoti .activity_details import ActivityDetails
17
18
from yoti .tests .conftest import YOTI_CLIENT_SDK_ID , PEM_FILE_PATH
18
19
from yoti .tests .mocks import (
@@ -63,7 +64,7 @@ def test_creating_client_instance_without_private_key_file():
63
64
def test_creating_client_instance_with_invalid_key_file_arg (key_file ):
64
65
with pytest .raises (RuntimeError ) as exc :
65
66
Client (YOTI_CLIENT_SDK_ID , key_file )
66
- expected_error = 'Invalid private key file argument specified in Client() '
67
+ expected_error = 'Could not read private key file'
67
68
assert expected_error in str (exc )
68
69
assert str (key_file ) in str (exc )
69
70
@@ -73,9 +74,10 @@ def test_creating_client_instance_with_invalid_key_file_env(key_file):
73
74
environ ['YOTI_KEY_FILE_PATH' ] = str (key_file )
74
75
with pytest .raises (RuntimeError ) as exc :
75
76
Client (YOTI_CLIENT_SDK_ID )
76
- expected_error = 'Invalid private key file specified by the ' \
77
- ' YOTI_KEY_FILE_PATH env variable'
77
+ expected_error = 'Could not read private key file'
78
+ expected_error_source = 'specified by the YOTI_KEY_FILE_PATH env variable'
78
79
assert expected_error in str (exc )
80
+ assert expected_error_source in str (exc )
79
81
assert str (key_file ) in str (exc )
80
82
81
83
@@ -88,7 +90,7 @@ def test_creating_client_instance_with_valid_key_file_env_but_invalid_key_file_a
88
90
environ ['YOTI_KEY_FILE_PATH' ] = PEM_FILE_PATH
89
91
with pytest .raises (RuntimeError ) as exc :
90
92
Client (YOTI_CLIENT_SDK_ID , INVALID_KEY_FILE_PATH )
91
- expected_error = 'Invalid private key file argument specified in Client() '
93
+ expected_error = 'Could not read private key file'
92
94
assert expected_error in str (exc )
93
95
assert str (INVALID_KEY_FILE_PATH ) in str (exc )
94
96
0 commit comments