summaryrefslogtreecommitdiff
path: root/jstests/auth/db_multiple_login.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/auth/db_multiple_login.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/auth/db_multiple_login.js')
-rw-r--r--jstests/auth/db_multiple_login.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/jstests/auth/db_multiple_login.js b/jstests/auth/db_multiple_login.js
index ed48bfb4e98..4a16efdf0f6 100644
--- a/jstests/auth/db_multiple_login.js
+++ b/jstests/auth/db_multiple_login.js
@@ -3,26 +3,28 @@
// authentication.
//
// Regression test for SERVER-8144.
-var conn = MongoRunner.runMongod({ auth: "", smallfiles: "" });
+var conn = MongoRunner.runMongod({auth: "", smallfiles: ""});
var admin = conn.getDB("admin");
var test = conn.getDB("test");
-admin.createUser({user:'admin', pwd: 'a', roles: jsTest.adminUserRoles});
+admin.createUser({user: 'admin', pwd: 'a', roles: jsTest.adminUserRoles});
assert(admin.auth('admin', 'a'));
-test.createUser({user: 'reader', pwd: 'a', roles: [ "read" ]});
-test.createUser({user: 'writer', pwd: 'a', roles: [ "readWrite" ]});
+test.createUser({user: 'reader', pwd: 'a', roles: ["read"]});
+test.createUser({user: 'writer', pwd: 'a', roles: ["readWrite"]});
admin.logout();
// Nothing logged in, can neither read nor write.
-assert.writeError(test.docs.insert({ value: 0 }));
-assert.throws(function() { test.foo.findOne(); });
+assert.writeError(test.docs.insert({value: 0}));
+assert.throws(function() {
+ test.foo.findOne();
+});
// Writer logged in, can read and write.
test.auth('writer', 'a');
-assert.writeOK(test.docs.insert({ value: 1 }));
+assert.writeOK(test.docs.insert({value: 1}));
test.foo.findOne();
// Reader logged in, replacing writer, can only read.
test.auth('reader', 'a');
-assert.writeError(test.docs.insert({ value: 2 }));
+assert.writeError(test.docs.insert({value: 2}));
test.foo.findOne();