File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 11PyYAML == 3.13
22Pygments == 2.2.0
3- VWS-Python-Mock == 2018.10.01.1
3+ VWS-Python-Mock == 2018.10.02.0
44autoflake == 1.2
55check-manifest == 0.37
66codecov == 2.0.15 # Upload coverage data
Original file line number Diff line number Diff line change 1414
1515from vws import VWS
1616from vws .exceptions import (
17+ AuthenticationFailure ,
1718 BadImage ,
1819 Fail ,
1920 ImageTooLarge ,
@@ -97,7 +98,7 @@ def test_request_quota_reached() -> None:
9798
9899def test_fail (high_quality_image : io .BytesIO ) -> None :
99100 """
100- A ``Fail`` exception is raised when there are authentication issues .
101+ A ``Fail`` exception is raised when the server access key does not exist .
101102 """
102103 with MockVWS ():
103104 client = VWS (
@@ -201,3 +202,26 @@ def test_metadata_too_large(
201202 )
202203
203204 assert exc .value .response .status_code == codes .UNPROCESSABLE_ENTITY
205+
206+
207+ def test_authentication_failure (high_quality_image : io .BytesIO ) -> None :
208+ """
209+ An ``AuthenticationFailure`` exception is raised when the server access key
210+ does not exist.
211+ """
212+ database = VuforiaDatabase ()
213+ with MockVWS () as mock :
214+ mock .add_database (database = database )
215+ client = VWS (
216+ server_access_key = database .server_access_key .decode (),
217+ server_secret_key = 'a' ,
218+ )
219+
220+ with pytest .raises (AuthenticationFailure ) as exc :
221+ client .add_target (
222+ name = 'x' ,
223+ width = 1 ,
224+ image = high_quality_image ,
225+ )
226+
227+ assert exc .value .response .status_code == codes .UNAUTHORIZED
You can’t perform that action at this time.
0 commit comments