Skip to content

Commit b31e6e5

Browse files
committed
Progress towards using requests_mock
1 parent 142bcb6 commit b31e6e5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/mock_vws/test_requests_mock_usage.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from freezegun import freeze_time
1515
from PIL import Image
1616
from requests.exceptions import MissingSchema
17-
from requests_mock.exceptions import NoMockAddress
1817
from vws import VWS, CloudRecoService
1918
from vws_auth_tools import rfc_1123_date
2019

@@ -43,8 +42,8 @@ def request_unmocked_address() -> None:
4342
Raises:
4443
requests.exceptions.ConnectionError: This is expected as there is
4544
nothing to connect to.
46-
requests_mock.exceptions.NoMockAddress: This request is being made in
47-
the context of a `requests_mock` mock which does not mock local
45+
requests.exceptions.ConnectionError: This request is being made in the
46+
context of a ``responses`` mock which does not mock local
4847
addresses.
4948
"""
5049
sock = socket.socket()
@@ -192,7 +191,9 @@ def test_custom_base_vws_url() -> None:
192191
base_vws_url="https://vuforia.vws.example.com",
193192
real_http=False,
194193
):
195-
with pytest.raises(expected_exception=NoMockAddress):
194+
with pytest.raises(
195+
expected_exception=requests.exceptions.ConnectionError
196+
):
196197
requests.get(url="https://vws.vuforia.com/summary", timeout=30)
197198

198199
requests.get(
@@ -213,7 +214,9 @@ def test_custom_base_vwq_url() -> None:
213214
base_vwq_url="https://vuforia.vwq.example.com",
214215
real_http=False,
215216
):
216-
with pytest.raises(expected_exception=NoMockAddress):
217+
with pytest.raises(
218+
expected_exception=requests.exceptions.ConnectionError
219+
):
217220
requests.post(
218221
url="https://cloudreco.vuforia.com/v1/query",
219222
timeout=30,

0 commit comments

Comments
 (0)