summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib/testing/fixtures/interface.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/resmokelib/testing/fixtures/interface.py')
-rw-r--r--buildscripts/resmokelib/testing/fixtures/interface.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/interface.py b/buildscripts/resmokelib/testing/fixtures/interface.py
index 0db4716f868..94dd3617c9c 100644
--- a/buildscripts/resmokelib/testing/fixtures/interface.py
+++ b/buildscripts/resmokelib/testing/fixtures/interface.py
@@ -339,5 +339,14 @@ def create_fixture_table(fixture):
return "Fixture status:\n" + table
+def authenticate(client, auth_options=None):
+ """Authenticate client for the 'authenticationDatabase' and return the client."""
+ if auth_options is not None:
+ auth_db = client[auth_options["authenticationDatabase"]]
+ auth_db.authenticate(auth_options["username"], password=auth_options["password"],
+ mechanism=auth_options["authenticationMechanism"])
+ return client
+
+
# Represents a row in a node info table.
NodeInfo = namedtuple('NodeInfo', ['full_name', 'name', 'port', 'pid'])