...
1==========
2Auth Tests
3==========
4
5The YAML and JSON files in this directory tree are platform-independent tests
6that drivers can use to prove their conformance to the Auth Spec at least with
7respect to connection string URI input.
8
9Drivers should do additional unit testing if there are alternate ways of
10configuring credentials on a client.
11
12Driver must also conduct the prose tests in the Auth Spec test plan section.
13
14Format
15------
16
17Each YAML file contains an object with a single ``tests`` key. This key is an
18array of test case objects, each of which have the following keys:
19
20- ``description``: A string describing the test.
21- ``uri``: A string containing the URI to be parsed.
22- ``valid:`` A boolean indicating if the URI should be considered valid.
23- ``credential``: If null, the credential must not be considered configured for the
24 the purpose of deciding if the driver should authenticate to the topology. If non-null,
25 it is an object containing one or more of the following properties of a credential:
26
27 - ``username``: A string containing the username. For auth mechanisms
28 that do not utilize a password, this may be the entire ``userinfo`` token
29 from the connection string.
30 - ``password``: A string containing the password.
31 - ``source``: A string containing the authentication database.
32 - ``mechanism``: A string containing the authentication mechanism. A null value for
33 this key is used to indicate that a mechanism wasn't specified and that mechanism
34 negotiation is required. Test harnesses should modify the mechanism test as needed
35 to assert this condition.
36 - ``mechanism_properties``: A document containing mechanism-specific properties. It
37 specifies a subset of properties that must match. If a key exists in the test data,
38 it must exist with the corresponding value in the credential. Other values may
39 exist in the credential without failing the test.
40
41If any key is missing, no assertion about that key is necessary. Except as
42specified explicitly above, if a key is present, but the test value is null,
43the observed value for that key must be uninitialized (whatever that means for
44a given driver and data type).
45
46Implementation notes
47====================
48
49Testing whether a URI is valid or not should simply be a matter of checking
50whether URI parsing (or MongoClient construction) raises an error or exception.
51
52If a credential is configured, its properties must be compared to the
53``credential`` field.
View as plain text