Skip to content

Commit 7931f70

Browse files
committed
Added uri options test for proxy options
1 parent b3020b5 commit 7931f70

File tree

2 files changed

+260
-0
lines changed

2 files changed

+260
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"tests": [
3+
{
4+
"description": "proxyPort without proxyHost",
5+
"uri": "mongodb://localhost/?proxyPort=1080",
6+
"valid": false,
7+
"warning": false,
8+
"hosts": null,
9+
"auth": null,
10+
"options": null
11+
},
12+
{
13+
"description": "proxyUsername without proxyHost",
14+
"uri": "mongodb://localhost/?proxyUsername=abc",
15+
"valid": false,
16+
"warning": false,
17+
"hosts": null,
18+
"auth": null,
19+
"options": null
20+
},
21+
{
22+
"description": "proxyPassword without proxyHost",
23+
"uri": "mongodb://localhost/?proxyPassword=def",
24+
"valid": false,
25+
"warning": false,
26+
"hosts": null,
27+
"auth": null,
28+
"options": null
29+
},
30+
{
31+
"description": "all other proxy options without proxyHost",
32+
"uri": "mongodb://localhost/?proxyPort=1080&proxyUsername=abc&proxyPassword=def",
33+
"valid": false,
34+
"warning": false,
35+
"hosts": null,
36+
"auth": null,
37+
"options": null
38+
},
39+
{
40+
"description": "proxyUsername without proxyPassword",
41+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc",
42+
"valid": false,
43+
"warning": false,
44+
"hosts": null,
45+
"auth": null,
46+
"options": null
47+
},
48+
{
49+
"description": "proxyPassword without proxyUsername",
50+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyPassword=def",
51+
"valid": false,
52+
"warning": false,
53+
"hosts": null,
54+
"auth": null,
55+
"options": null
56+
},
57+
{
58+
"description": "multiple proxyHost parameters",
59+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyHost=localhost2",
60+
"valid": false,
61+
"warning": false,
62+
"hosts": null,
63+
"auth": null,
64+
"options": null
65+
},
66+
{
67+
"description": "multiple proxyPort parameters",
68+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyPort=1234&proxyPort=12345",
69+
"valid": false,
70+
"warning": false,
71+
"hosts": null,
72+
"auth": null,
73+
"options": null
74+
},
75+
{
76+
"description": "multiple proxyUsername parameters",
77+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc&proxyUsername=def&proxyPassword=123",
78+
"valid": false,
79+
"warning": false,
80+
"hosts": null,
81+
"auth": null,
82+
"options": null
83+
},
84+
{
85+
"description": "multiple proxyPassword parameters",
86+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc&proxyPassword=123&proxyPassword=456",
87+
"valid": false,
88+
"warning": false,
89+
"hosts": null,
90+
"auth": null,
91+
"options": null
92+
},
93+
{
94+
"description": "only host present",
95+
"uri": "mongodb://localhost/?proxyHost=localhost",
96+
"valid": true,
97+
"warning": false,
98+
"hosts": null,
99+
"auth": null,
100+
"options": {}
101+
},
102+
{
103+
"description": "host and default port present",
104+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyPort=1080",
105+
"valid": true,
106+
"warning": false,
107+
"hosts": null,
108+
"auth": null,
109+
"options": {}
110+
},
111+
{
112+
"description": "host and non-default port present",
113+
"uri": "mongodb://localhost/?proxyHost=localhost&proxyPort=12345",
114+
"valid": true,
115+
"warning": false,
116+
"hosts": null,
117+
"auth": null,
118+
"options": {}
119+
},
120+
{
121+
"description": "replicaset, host and non-default port present",
122+
"uri": "mongodb://rs1,rs2,rs3/?proxyHost=localhost&proxyPort=12345",
123+
"valid": true,
124+
"warning": false,
125+
"hosts": null,
126+
"auth": null,
127+
"options": {}
128+
},
129+
{
130+
"description": "all options present",
131+
"uri": "mongodb://rs1,rs2,rs3/?proxyHost=localhost&proxyPort=12345&proxyUsername=asdf&proxyPassword=qwerty",
132+
"valid": true,
133+
"warning": false,
134+
"hosts": null,
135+
"auth": null,
136+
"options": {}
137+
}
138+
]
139+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
tests:
2+
-
3+
description: "proxyPort without proxyHost"
4+
uri: "mongodb://localhost/?proxyPort=1080"
5+
valid: false
6+
warning: false
7+
hosts: ~
8+
auth: ~
9+
options: ~
10+
-
11+
description: "proxyUsername without proxyHost"
12+
uri: "mongodb://localhost/?proxyUsername=abc"
13+
valid: false
14+
warning: false
15+
hosts: ~
16+
auth: ~
17+
options: ~
18+
-
19+
description: "proxyPassword without proxyHost"
20+
uri: "mongodb://localhost/?proxyPassword=def"
21+
valid: false
22+
warning: false
23+
hosts: ~
24+
auth: ~
25+
options: ~
26+
-
27+
description: "all other proxy options without proxyHost"
28+
uri: "mongodb://localhost/?proxyPort=1080&proxyUsername=abc&proxyPassword=def"
29+
valid: false
30+
warning: false
31+
hosts: ~
32+
auth: ~
33+
options: ~
34+
-
35+
description: "proxyUsername without proxyPassword"
36+
uri: "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc"
37+
valid: false
38+
warning: false
39+
hosts: ~
40+
auth: ~
41+
options: ~
42+
-
43+
description: "proxyPassword without proxyUsername"
44+
uri: "mongodb://localhost/?proxyHost=localhost&proxyPassword=def"
45+
valid: false
46+
warning: false
47+
hosts: ~
48+
auth: ~
49+
options: ~
50+
-
51+
description: "multiple proxyHost parameters"
52+
uri: "mongodb://localhost/?proxyHost=localhost&proxyHost=localhost2"
53+
valid: false
54+
warning: false
55+
hosts: ~
56+
auth: ~
57+
options: ~
58+
-
59+
description: "multiple proxyPort parameters"
60+
uri: "mongodb://localhost/?proxyHost=localhost&proxyPort=1234&proxyPort=12345"
61+
valid: false
62+
warning: false
63+
hosts: ~
64+
auth: ~
65+
options: ~
66+
-
67+
description: "multiple proxyUsername parameters"
68+
uri: "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc&proxyUsername=def&proxyPassword=123"
69+
valid: false
70+
warning: false
71+
hosts: ~
72+
auth: ~
73+
options: ~
74+
-
75+
description: "multiple proxyPassword parameters"
76+
uri: "mongodb://localhost/?proxyHost=localhost&proxyUsername=abc&proxyPassword=123&proxyPassword=456"
77+
valid: false
78+
warning: false
79+
hosts: ~
80+
auth: ~
81+
options: ~
82+
-
83+
description: "only host present"
84+
uri: "mongodb://localhost/?proxyHost=localhost"
85+
valid: true
86+
warning: false
87+
hosts: ~
88+
auth: ~
89+
options: {}
90+
-
91+
description: "host and default port present"
92+
uri: "mongodb://localhost/?proxyHost=localhost&proxyPort=1080"
93+
valid: true
94+
warning: false
95+
hosts: ~
96+
auth: ~
97+
options: {}
98+
-
99+
description: "host and non-default port present"
100+
uri: "mongodb://localhost/?proxyHost=localhost&proxyPort=12345"
101+
valid: true
102+
warning: false
103+
hosts: ~
104+
auth: ~
105+
options: {}
106+
-
107+
description: "replicaset, host and non-default port present"
108+
uri: "mongodb://rs1,rs2,rs3/?proxyHost=localhost&proxyPort=12345"
109+
valid: true
110+
warning: false
111+
hosts: ~
112+
auth: ~
113+
options: {}
114+
-
115+
description: "all options present"
116+
uri: "mongodb://rs1,rs2,rs3/?proxyHost=localhost&proxyPort=12345&proxyUsername=asdf&proxyPassword=qwerty"
117+
valid: true
118+
warning: false
119+
hosts: ~
120+
auth: ~
121+
options: {}

0 commit comments

Comments
 (0)