@@ -607,7 +607,7 @@ def test_need_kms_gcp_credentials(self):
607607 encrypter = AutoEncrypter (callback , opts )
608608 self .addCleanup (encrypter .close )
609609
610- with respx .mock () as router :
610+ with respx .mock (using = "httpx" ) as router :
611611 data = {"access_token" : "foo" }
612612 url = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
613613 router .add (
@@ -748,7 +748,7 @@ async def test_need_kms_gcp_credentials(self):
748748 encrypter = AsyncAutoEncrypter (callback , opts )
749749 self .addAsyncCleanup (encrypter .close )
750750
751- with respx .mock () as router :
751+ with respx .mock (using = "httpx" ) as router :
752752 data = {"access_token" : "foo" }
753753 url = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
754754 router .add (
@@ -1019,7 +1019,7 @@ def get_encrypter(self, clear_cache=True):
10191019
10201020 def test_success (self ):
10211021 encrypter = self .get_encrypter ()
1022- with respx .mock () as router :
1022+ with respx .mock (using = "httpx" ) as router :
10231023 data = {"access_token" : "foo" , "expires_in" : 4000 }
10241024 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10251025 router .add (
@@ -1034,7 +1034,7 @@ def test_success(self):
10341034
10351035 def test_empty_json (self ):
10361036 encrypter = self .get_encrypter ()
1037- with respx .mock () as router :
1037+ with respx .mock (using = "httpx" ) as router :
10381038 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10391039 router .add (
10401040 respx .get (url = url ).mock (return_value = httpx .Response (200 , json = {}))
@@ -1048,7 +1048,7 @@ def test_empty_json(self):
10481048
10491049 def test_bad_json (self ):
10501050 encrypter = self .get_encrypter ()
1051- with respx .mock () as router :
1051+ with respx .mock (using = "httpx" ) as router :
10521052 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10531053 router .add (
10541054 respx .get (url = url ).mock (return_value = httpx .Response (200 , text = "a'" ))
@@ -1062,7 +1062,7 @@ def test_bad_json(self):
10621062
10631063 def test_http_404 (self ):
10641064 encrypter = self .get_encrypter ()
1065- with respx .mock () as router :
1065+ with respx .mock (using = "httpx" ) as router :
10661066 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10671067 router .add (respx .get (url = url ).mock (return_value = httpx .Response (404 )))
10681068 with self .assertRaisesRegex (
@@ -1074,7 +1074,7 @@ def test_http_404(self):
10741074
10751075 def test_http_500 (self ):
10761076 encrypter = self .get_encrypter ()
1077- with respx .mock () as router :
1077+ with respx .mock (using = "httpx" ) as router :
10781078 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10791079 router .add (respx .get (url = url ).mock (return_value = httpx .Response (500 )))
10801080 with self .assertRaisesRegex (
@@ -1086,7 +1086,7 @@ def test_http_500(self):
10861086
10871087 def test_slow_response (self ):
10881088 encrypter = self .get_encrypter ()
1089- with respx .mock () as router :
1089+ with respx .mock (using = "httpx" ) as router :
10901090 url = "http://169.254.169.254/metadata/identity/oauth2/token"
10911091 router .add (
10921092 respx .get (url = url ).mock (side_effect = httpx ._exceptions .ConnectTimeout )
@@ -1100,7 +1100,7 @@ def test_slow_response(self):
11001100
11011101 def test_cache (self ):
11021102 encrypter = self .get_encrypter ()
1103- with respx .mock () as router :
1103+ with respx .mock (using = "httpx" ) as router :
11041104 data = {"access_token" : "foo" , "expires_in" : 4000 }
11051105 url = "http://169.254.169.254/metadata/identity/oauth2/token"
11061106 router .add (
@@ -1121,7 +1121,7 @@ def test_cache(self):
11211121
11221122 def test_cache_expires_soon (self ):
11231123 encrypter = self .get_encrypter ()
1124- with respx .mock () as router :
1124+ with respx .mock (using = "httpx" ) as router :
11251125 data = {"access_token" : "foo" , "expires_in" : 10 }
11261126 url = "http://169.254.169.254/metadata/identity/oauth2/token"
11271127 router .add (
@@ -1137,7 +1137,7 @@ def test_cache_expires_soon(self):
11371137 # Should not use the cached value.
11381138 encrypter = self .get_encrypter (False )
11391139 self .assertIsNotNone (pymongocrypt .synchronous .credentials ._azure_creds_cache )
1140- with respx .mock () as router :
1140+ with respx .mock (using = "httpx" ) as router :
11411141 url = "http://169.254.169.254/metadata/identity/oauth2/token"
11421142 router .add (
11431143 respx .get (url = url ).mock (side_effect = httpx ._exceptions .ConnectTimeout )
0 commit comments