Skip to content

Commit d42c510

Browse files
committed
PYTHON-2183 Test that readPreferenceTags are always interpreted as an array
Also resolves PYTHON-2085.
1 parent fd64f4d commit d42c510

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

test/uri_options/auth-options.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"tests": [
33
{
4-
"description": "Valid auth options are parsed correctly",
4+
"description": "Valid auth options are parsed correctly (GSSAPI)",
55
"uri": "mongodb://foo:bar@example.com/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authSource=$external",
66
"valid": true,
77
"warning": false,
@@ -15,6 +15,18 @@
1515
},
1616
"authSource": "$external"
1717
}
18+
},
19+
{
20+
"description": "Valid auth options are parsed correctly (SCRAM-SHA-1)",
21+
"uri": "mongodb://foo:bar@example.com/?authMechanism=SCRAM-SHA-1&authSource=authSourceDB",
22+
"valid": true,
23+
"warning": false,
24+
"hosts": null,
25+
"auth": null,
26+
"options": {
27+
"authMechanism": "SCRAM-SHA-1",
28+
"authSource": "authSourceDB"
29+
}
1830
}
1931
]
2032
}

test/uri_options/concern-options.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@
3636
"w": "arbitraryButStillValid"
3737
}
3838
},
39-
{
40-
"description": "Too low w causes a warning",
41-
"uri": "mongodb://example.com/?w=-2",
42-
"valid": true,
43-
"warning": true,
44-
"hosts": null,
45-
"auth": null,
46-
"options": {}
47-
},
4839
{
4940
"description": "Non-numeric wTimeoutMS causes a warning",
5041
"uri": "mongodb://example.com/?wTimeoutMS=invalid",

test/uri_options/read-preference-options.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121
"maxStalenessSeconds": 120
2222
}
2323
},
24+
{
25+
"description": "Single readPreferenceTags is parsed as array of size one",
26+
"uri": "mongodb://example.com/?readPreferenceTags=dc:ny",
27+
"valid": true,
28+
"warning": false,
29+
"hosts": null,
30+
"auth": null,
31+
"options": {
32+
"readPreferenceTags": [
33+
{
34+
"dc": "ny"
35+
}
36+
]
37+
}
38+
},
2439
{
2540
"description": "Invalid readPreferenceTags causes a warning",
2641
"uri": "mongodb://example.com/?readPreferenceTags=invalid",

0 commit comments

Comments
 (0)