File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -411,11 +411,14 @@ def test_uri_without_credentials_doesnt_override_conn_settings(self):
411411 # OperationFailure means that mongoengine attempted authentication
412412 # w/ the provided username/password and failed - that's the desired
413413 # behavior. If the MongoDB URI would override the credentials
414- with pytest . raises ( OperationFailure ):
415- db = get_db ()
416- # pymongo 4.x does not call db.authenticate and needs to perform an operation to trigger the failure
417- if PYMONGO_VERSION >= ( 4 ,):
414+ if PYMONGO_VERSION >= ( 4 , ):
415+ with pytest . raises ( OperationFailure ):
416+ db = get_db ()
417+ # pymongo 4.x does not call db.authenticate and needs to perform an operation to trigger the failure
418418 db .list_collection_names ()
419+ else :
420+ with pytest .raises (OperationFailure ):
421+ db = get_db ()
419422
420423 def test_connect_uri_with_authsource (self ):
421424 """Ensure that the connect() method works well with `authSource`
You can’t perform that action at this time.
0 commit comments