@@ -824,30 +824,21 @@ def fetch(self, a):
824
824
# Close the client.
825
825
client .close ()
826
826
827
- def test_2_4_oidc_callback_returns_invalid_data (self ):
828
- # Create a MongoClient configured with an OIDC callback that returns data not conforming to the OIDCCredential with extra fields.
829
- class CustomCallback (OIDCCallback ):
830
- count = 0
831
-
832
- def fetch (self , a ):
833
- self .count += 1
834
- return OIDCCallbackResult (access_token = "bad value" )
835
-
836
- client = self .create_client (request_cb = CustomCallback ())
837
- # Perform a ``find`` operation that fails.
838
- with self .assertRaises (OperationFailure ):
839
- client .test .test .find_one ()
840
- # Close the client.
841
- client .close ()
842
-
843
- def test_2_5_invalid_client_configuration_with_callback (self ):
827
+ def test_2_4_invalid_client_configuration_with_callback (self ):
844
828
# Create a MongoClient configured with an OIDC callback and auth mechanism property ENVIRONMENT:test.
845
829
request_cb = self .create_request_cb ()
846
830
props : Dict = {"OIDC_CALLBACK" : request_cb , "ENVIRONMENT" : "test" }
847
831
# Assert it returns a client configuration error.
848
832
with self .assertRaises (ConfigurationError ):
849
833
self .create_client (authmechanismproperties = props )
850
834
835
+ def test_2_5_invalid_use_of_ALLOWED_HOSTS (self ):
836
+ # Create an OIDC configured client with auth mechanism properties `{"ENVIRONMENT": "azure", "ALLOWED_HOSTS": []}`.
837
+ props : Dict = {"ENVIRONMENT" : "azure" , "ALLOWED_HOSTS" : []}
838
+ # Assert it returns a client configuration error.
839
+ with self .assertRaises (ConfigurationError ):
840
+ self .create_client (authmechanismproperties = props )
841
+
851
842
def test_3_1_authentication_failure_with_cached_tokens_fetch_a_new_token_and_retry (self ):
852
843
# Create a MongoClient and an OIDC callback that implements the provider logic.
853
844
client = self .create_client ()
0 commit comments