File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ describe('Authentication Spec Prose Tests', function () {
203
203
* the other mechanism fails.
204
204
*/
205
205
it (
206
- 'fails to connect if incorrect auth mechanism is explicitly specified' ,
206
+ 'fails to connect if incorrect auth mechanism (SCRAM-SHA-1) is explicitly specified' ,
207
207
metadata ,
208
208
async function ( ) {
209
209
const options = {
@@ -225,6 +225,29 @@ describe('Authentication Spec Prose Tests', function () {
225
225
}
226
226
) ;
227
227
228
+ it (
229
+ 'fails to connect if incorrect auth mechanism (SCRAM-SHA-256) is explicitly specified' ,
230
+ metadata ,
231
+ async function ( ) {
232
+ const options = {
233
+ auth : {
234
+ username : userMap . sha1 . username ,
235
+ password : userMap . sha1 . password
236
+ } ,
237
+ authSource : 'admin' ,
238
+ authMechanism : 'SCRAM-SHA-256'
239
+ } ;
240
+
241
+ const client = this . configuration . newClient ( { } , options ) ;
242
+ const error = await client
243
+ . db ( 'test' )
244
+ . stats ( )
245
+ . catch ( e => e ) ;
246
+ expect ( error . message ) . to . match ( / A u t h e n t i c a t i o n f a i l e d | S C R A M / ) ;
247
+ await client . close ( ) ;
248
+ }
249
+ ) ;
250
+
228
251
/*
229
252
* Step 3
230
253
* For a non-existent username, verify that not specifying a mechanism when
@@ -276,7 +299,7 @@ describe('Authentication Spec Prose Tests', function () {
276
299
) ;
277
300
278
301
it (
279
- 'sends speculativeAuthenticate on initial handshake on MongoDB 4.4+ ' ,
302
+ 'sends speculativeAuthenticate on initial handshake on MongoDB' ,
280
303
metadata ,
281
304
async function ( ) {
282
305
const options = {
You can’t perform that action at this time.
0 commit comments