Skip to content

Commit 2a91175

Browse files
Enabled storage password server test
After updating the password, assertion which is using clear_password field have been removed.
1 parent 26d419c commit 2a91175

File tree

1 file changed

+67
-71
lines changed

1 file changed

+67
-71
lines changed

tests/service_tests/storagepasswords.js

Lines changed: 67 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -456,79 +456,75 @@ module.exports = function(svc) {
456456
);
457457
},
458458

459-
// Disabling this test because clear_password field has been removed in Splunk 8.2
460-
//
461-
//
462-
// "Callback#Update": function(test) {
463-
// var startcount = -1;
464-
// var name = "delete-me-" + getNextId();
465-
// var realm = "delete-me-" + getNextId();
466-
// var that = this;
467-
// Async.chain([
468-
// function(done) {
469-
// that.service.storagePasswords().fetch(done);
470-
// },
471-
// function(storagePasswords, done) {
472-
// startcount = storagePasswords.list().length;
473-
// storagePasswords.create({name: name, realm: realm, password: "changed!"}, done);
474-
// },
475-
// function(storagePassword, done) {
476-
// test.strictEqual(name, storagePassword.properties().username);
477-
// test.strictEqual(realm + ":" + name + ":", storagePassword.name);
478-
// test.strictEqual("changed!", storagePassword.properties().clear_password);
479-
// test.strictEqual(realm, storagePassword.properties().realm);
480-
// that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
481-
// },
482-
// function(storagePasswords, storagePassword, done) {
483-
// test.strictEqual(startcount + 1, storagePasswords.list().length);
484-
// storagePassword.update({password: "changed"}, done);
485-
// },
486-
// function(storagePassword, done) {
487-
// test.strictEqual(name, storagePassword.properties().username);
488-
// test.strictEqual(realm + ":" + name + ":", storagePassword.name);
489-
// test.strictEqual("changed", storagePassword.properties().clear_password);
490-
// test.strictEqual(realm, storagePassword.properties().realm);
491-
// that.service.storagePasswords().fetch(done);
492-
// },
493-
// function(storagePasswords, done) {
494-
// var list = storagePasswords.list();
495-
// var found = false;
496-
// var index = -1;
459+
"Callback#Update": function(test) {
460+
var startcount = -1;
461+
var name = "delete-me-" + getNextId();
462+
var realm = "delete-me-" + getNextId();
463+
var that = this;
464+
Async.chain([
465+
function(done) {
466+
that.service.storagePasswords().fetch(done);
467+
},
468+
function(storagePasswords, done) {
469+
startcount = storagePasswords.list().length;
470+
storagePasswords.create({name: name, realm: realm, password: "changed!"}, done);
471+
},
472+
function(storagePassword, done) {
473+
test.strictEqual(name, storagePassword.properties().username);
474+
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
475+
test.strictEqual("changed!", storagePassword.properties().clear_password);
476+
test.strictEqual(realm, storagePassword.properties().realm);
477+
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
478+
},
479+
function(storagePasswords, storagePassword, done) {
480+
test.strictEqual(startcount + 1, storagePasswords.list().length);
481+
storagePassword.update({password: "changed"}, done);
482+
},
483+
function(storagePassword, done) {
484+
test.strictEqual(name, storagePassword.properties().username);
485+
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
486+
test.strictEqual(realm, storagePassword.properties().realm);
487+
that.service.storagePasswords().fetch(done);
488+
},
489+
function(storagePasswords, done) {
490+
var list = storagePasswords.list();
491+
var found = false;
492+
var index = -1;
497493

498-
// test.strictEqual(startcount + 1, list.length);
499-
// for (var i = 0; i < list.length; i ++) {
500-
// if (realm + ":" + name + ":" === list[i].name) {
501-
// found = true;
502-
// index = i;
503-
// test.strictEqual(name, list[i].properties().username);
504-
// test.strictEqual(realm + ":" + name + ":", list[i].name);
505-
// test.strictEqual("changed", list[i].properties().clear_password);
506-
// test.strictEqual(realm, list[i].properties().realm);
507-
// }
508-
// }
509-
// test.ok(found);
494+
test.strictEqual(startcount + 1, list.length);
495+
for (var i = 0; i < list.length; i ++) {
496+
if (realm + ":" + name + ":" === list[i].name) {
497+
found = true;
498+
index = i;
499+
test.strictEqual(name, list[i].properties().username);
500+
test.strictEqual(realm + ":" + name + ":", list[i].name);
501+
test.strictEqual("changed", list[i].properties().clear_password);
502+
test.strictEqual(realm, list[i].properties().realm);
503+
}
504+
}
505+
test.ok(found);
510506

511-
// if (!found) {
512-
// done(new Error("Didn't find the created password"));
513-
// }
514-
// else {
515-
// list[index].remove(done);
516-
// }
517-
// },
518-
// function(done) {
519-
// that.service.storagePasswords().fetch(done);
520-
// },
521-
// function(storagePasswords, done) {
522-
// test.strictEqual(startcount, storagePasswords.list().length);
523-
// done();
524-
// }
525-
// ],
526-
// function(err) {
527-
// test.ok(!err);
528-
// test.done();
529-
// }
530-
// );
531-
// },
507+
if (!found) {
508+
done(new Error("Didn't find the created password"));
509+
}
510+
else {
511+
list[index].remove(done);
512+
}
513+
},
514+
function(done) {
515+
that.service.storagePasswords().fetch(done);
516+
},
517+
function(storagePasswords, done) {
518+
test.strictEqual(startcount, storagePasswords.list().length);
519+
done();
520+
}
521+
],
522+
function(err) {
523+
test.ok(!err);
524+
test.done();
525+
}
526+
);
527+
},
532528

533529
"Callback#Delete": function(test) {
534530
var startcount = -1;

0 commit comments

Comments
 (0)