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.
| 64 | |
| 65 | |
| 66 | class 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 | |
| 86 | class TestGSSAPI(AsyncPyMongoTestCase): |
no outgoing calls