Skip to content

Commit d0de7f6

Browse files
committed
Move exception test to exceptions
1 parent ef5911f commit d0de7f6

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

tests/test_exceptions.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from PIL import Image
1313
from requests import codes
1414

15-
from vws import VWS
15+
from vws import CloudRecoService, VWS
1616
from vws.exceptions import (
1717
AuthenticationFailure,
1818
BadImage,
@@ -230,6 +230,16 @@ def test_authentication_failure(high_quality_image: io.BytesIO) -> None:
230230

231231
assert exc.value.response.status_code == codes.UNAUTHORIZED
232232

233+
cloud_reco_client = CloudRecoService(
234+
client_access_key=database.client_access_key,
235+
client_secret_key='a',
236+
)
237+
238+
with pytest.raises(AuthenticationFailure) as exc:
239+
cloud_reco_client.query(image=high_quality_image)
240+
241+
assert exc.value.response.status_code == codes.UNAUTHORIZED
242+
233243

234244
def test_target_status_not_success(
235245
vws_client: VWS,

tests/test_query.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,6 @@ def test_too_many(
130130
)
131131
assert str(exc.value) == expected_value
132132

133-
class TestBadCredentials:
134-
"""
135-
Tests for using bad credentials.
136-
"""
137-
138-
def test_bad_credentials(self, high_quality_image: io.BytesIO):
139-
cloud_reco_client = CloudRecoService(
140-
client_access_key='a',
141-
client_secret_key='a',
142-
)
143-
with pytest.raises(AuthenticationFailure) as exc:
144-
cloud_reco_client.query(image=high_quality_image)
145-
146-
assert exc.value.response.status_code == codes.UNAUTHORIZED
147-
148133

149134
# TODO test custom base URL
150135
# TODO test options - include_target_data

0 commit comments

Comments
 (0)