summaryrefslogtreecommitdiff
path: root/jstests/core/validate_user_documents.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/validate_user_documents.js')
-rw-r--r--jstests/core/validate_user_documents.js37
1 files changed, 14 insertions, 23 deletions
diff --git a/jstests/core/validate_user_documents.js b/jstests/core/validate_user_documents.js
index 825e1e7de11..9c12e6075a7 100644
--- a/jstests/core/validate_user_documents.js
+++ b/jstests/core/validate_user_documents.js
@@ -1,11 +1,10 @@
// Ensure that inserts and updates of the system.users collection validate the schema of inserted
// documents.
-mydb = db.getSisterDB( "validate_user_documents" );
+mydb = db.getSisterDB("validate_user_documents");
function assertGLEOK(status) {
- assert(status.ok && status.err === null,
- "Expected OK status object; found " + tojson(status));
+ assert(status.ok && status.err === null, "Expected OK status object; found " + tojson(status));
}
function assertGLENotOK(status) {
@@ -21,34 +20,26 @@ mydb.dropAllUsers();
//
// V0 user document document; insert should fail.
-assert.commandFailed(mydb.runCommand({ createUser:1,
- user: "spencer",
- pwd: "password",
- readOnly: true }));
+assert.commandFailed(
+ mydb.runCommand({createUser: 1, user: "spencer", pwd: "password", readOnly: true}));
// V1 user document; insert should fail.
-assert.commandFailed(mydb.runCommand({ createUser:1,
- user: "spencer",
- userSource: "test2",
- roles: ["dbAdmin"] }));
+assert.commandFailed(
+ mydb.runCommand({createUser: 1, user: "spencer", userSource: "test2", roles: ["dbAdmin"]}));
// Valid V2 user document; insert should succeed.
-assert.commandWorked(mydb.runCommand({ createUser: "spencer",
- pwd: "password",
- roles: ["dbAdmin"] }));
+assert.commandWorked(mydb.runCommand({createUser: "spencer", pwd: "password", roles: ["dbAdmin"]}));
// Valid V2 user document; insert should succeed.
-assert.commandWorked(mydb.runCommand({ createUser: "andy",
- pwd: "password",
- roles: [{role: "dbAdmin",
- db: "validate_user_documents",
- hasRole: true,
- canDelegate: false}] }));
+assert.commandWorked(mydb.runCommand({
+ createUser: "andy",
+ pwd: "password",
+ roles:
+ [{role: "dbAdmin", db: "validate_user_documents", hasRole: true, canDelegate: false}]
+}));
// Non-existent role; insert should fail
-assert.commandFailed(mydb.runCommand({ createUser: "bob",
- pwd: "password",
- roles: ["fakeRole123"] }));
+assert.commandFailed(mydb.runCommand({createUser: "bob", pwd: "password", roles: ["fakeRole123"]}));
//
// Tests of the update path