summaryrefslogtreecommitdiff
path: root/jstests/auth/auth2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/auth/auth2.js')
-rw-r--r--jstests/auth/auth2.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/jstests/auth/auth2.js b/jstests/auth/auth2.js
index 52d1fac084b..f09d87d7275 100644
--- a/jstests/auth/auth2.js
+++ b/jstests/auth/auth2.js
@@ -1,24 +1,32 @@
// test read/write permissions
m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1", nojournal: "", smallfiles: ""});
-db = m.getDB( "admin" );
+db = m.getDB("admin");
// These statements throw because the localhost exception does not allow
// these operations: it only allows the creation of the first admin user
// and necessary setup operations.
-assert.throws( function(){ db.users.count(); } );
-assert.throws( function() { db.shutdownServer(); } );
+assert.throws(function() {
+ db.users.count();
+});
+assert.throws(function() {
+ db.shutdownServer();
+});
-db.createUser( { user: "eliot", pwd: "eliot", roles: [ "root" ] } );
+db.createUser({user: "eliot", pwd: "eliot", roles: ["root"]});
// These statements throw because we have a user but have not authenticated
// as that user.
-assert.throws( function(){ db.users.count(); } );
-assert.throws( function() { db.shutdownServer(); } );
+assert.throws(function() {
+ db.users.count();
+});
+assert.throws(function() {
+ db.shutdownServer();
+});
-db.auth( "eliot", "eliot" );
+db.auth("eliot", "eliot");
-users = db.getCollection( "system.users" );
-assert.eq( 1, users.count() );
+users = db.getCollection("system.users");
+assert.eq(1, users.count());
db.shutdownServer();