diff options
author | Mathias Stearn <mathias@10gen.com> | 2011-05-31 13:34:36 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2011-05-31 15:28:56 -0400 |
commit | acc05925636f6709e95b927daaae593ff05b5a80 (patch) | |
tree | 4cdc34836e4281b94a33b25338d65e510cd8dac0 /jstests/auth/rename.js | |
parent | 13364b16f47fb83b3cc5b9946fd1c9e2b57ae7eb (diff) | |
download | mongo-acc05925636f6709e95b927daaae593ff05b5a80.tar.gz |
make auth/rename.js test a little cleaner
Diffstat (limited to 'jstests/auth/rename.js')
-rw-r--r-- | jstests/auth/rename.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/jstests/auth/rename.js b/jstests/auth/rename.js index 424f2548c09..5411298cd44 100644 --- a/jstests/auth/rename.js +++ b/jstests/auth/rename.js @@ -7,6 +7,7 @@ m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, " db1 = m.getDB( baseName ) db2 = m.getDB( baseName + '_other' ) +admin = m.getDB( 'admin' ) // auth not yet checked since we are on localhost db1.addUser( "foo", "bar" ); @@ -17,21 +18,21 @@ db1.a.save({}); assert.eq(db1.a.count(), 1); //this makes auth required on localhost -m.getDB('admin').addUser('not', 'used'); +admin.addUser('not', 'used'); // can't run same db w/o auth -assert.commandFailed( db1.adminCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); +assert.commandFailed( admin.runCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); // can run same db with auth db1.auth('foo', 'bar') -assert.commandWorked( db1.adminCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); +assert.commandWorked( admin.runCommand({renameCollection:db1.a.getFullName(), to: db1.b.getFullName()}) ); // can't run diff db w/o auth -assert.commandFailed( db1.adminCommand({renameCollection:db1.b.getFullName(), to: db2.a.getFullName()}) ); +assert.commandFailed( admin.runCommand({renameCollection:db1.b.getFullName(), to: db2.a.getFullName()}) ); // can run diff db with auth db2.auth('bar', 'foo'); -assert.commandWorked( db1.adminCommand({renameCollection:db1.b.getFullName(), to: db2.a.getFullName()}) ); +assert.commandWorked( admin.runCommand({renameCollection:db1.b.getFullName(), to: db2.a.getFullName()}) ); // test post conditions assert.eq(db1.a.count(), 0); |