MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / AutoAuthenticateThread

Class AutoAuthenticateThread

test/asynchronous/test_auth.py:66–83  ·  view source on GitHub ↗

Used in testing threaded authentication. This does await collection.find_one() with a 1-second delay to ensure it must check out and authenticate multiple connections from the pool concurrently. :Parameters: `collection`: An auth-protected collection containing one document.

Source from the content-addressed store, hash-verified

64
65
66class AutoAuthenticateThread(threading.Thread):
67 """Used in testing threaded authentication.
68
69 This does await collection.find_one() with a 1-second delay to ensure it must
70 check out and authenticate multiple connections from the pool concurrently.
71
72 :Parameters:
73 `collection`: An auth-protected collection containing one document.
74 """
75
76 def __init__(self, collection):
77 super().__init__()
78 self.collection = collection
79 self.success = False
80
81 def run(self):
82 assert self.collection.find_one({"$where": delay(1)}) is not None
83 self.success = True
84
85
86class TestGSSAPI(AsyncPyMongoTestCase):

Callers 2

test_gssapi_threadedMethod · 0.70
test_scram_threadedMethod · 0.70

Calls

no outgoing calls

Tested by 2

test_gssapi_threadedMethod · 0.56
test_scram_threadedMethod · 0.56