Files
mongo/jstests/auth.js
Eliot Horowitz a85951a535 cleaning
2009-01-31 18:06:10 -05:00

19 lines
496 B
JavaScript

users = db.getCollection( "system.users" );
users.remove( {} );
pass = "a" + Math.random();
//print( "password [" + pass + "]" );
db.addUser( "eliot" , pass );
assert( db.auth( "eliot" , pass ) , "auth failed" );
assert( ! db.auth( "eliot" , pass + "a" ) , "auth should have failed" );
pass2 = "b" + Math.random();
db.addUser( "eliot" , pass2 );
assert( ! db.auth( "eliot" , pass ) , "failed to change password failed" );
assert( db.auth( "eliot" , pass2 ) , "new password didn't take" );