File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 123
123
let ( :options ) { SpecConfig . instance . ssl_options . merge (
124
124
user : 'nonexistent_user' , password : 'foo' ) }
125
125
126
- it 'reports auth source used' do
127
- expect do
128
- connection . connect!
129
- end . to raise_error ( Mongo ::Auth ::Unauthorized , /User nonexistent_user.*is not authorized to access admin.*auth source: admin/ )
130
- end
131
-
132
126
it 'reports which server authentication was attempted against' do
133
127
expect do
134
128
connection . connect!
135
129
end . to raise_error ( Mongo ::Auth ::Unauthorized , /used server: #{ connection . address . to_s } / )
136
130
end
131
+
132
+ context 'with default auth source' do
133
+ it 'reports auth source used' do
134
+ expect do
135
+ connection . connect!
136
+ end . to raise_error ( Mongo ::Auth ::Unauthorized , /auth source: admin/ )
137
+ end
138
+ end
139
+
140
+ context 'with custom auth source' do
141
+ let ( :options ) { SpecConfig . instance . ssl_options . merge (
142
+ user : 'nonexistent_user' , password : 'foo' , auth_source : 'authdb' ) }
143
+
144
+ it 'reports auth source used' do
145
+ expect do
146
+ connection . connect!
147
+ end . to raise_error ( Mongo ::Auth ::Unauthorized , /auth source: authdb/ )
148
+ end
149
+ end
137
150
end
138
151
139
152
context 'attempting to connect to a non-tls server with tls' do
You can’t perform that action at this time.
0 commit comments