Skip to content

Commit b20d732

Browse files
author
Shakeel Mohamed
authored
Merge pull request #90 from splunk/restore_clear_password
Restore clear_password property for StoragePasswords creation
2 parents b34e502 + 55484ee commit b20d732

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/service.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,15 @@
19031903
* @extends splunkjs.Service.Collection
19041904
*/
19051905
root.StoragePasswords = root.Collection.extend({
1906+
/**
1907+
* Indicates whether to call `fetch` after an entity has been created. By
1908+
* default, the entity is not fetched because the endpoint returns
1909+
* (echoes) the new entity.
1910+
*
1911+
* @method splunkjs.Service.StoragePasswords
1912+
*/
1913+
fetchOnEntityCreation: true,
1914+
19061915
/**
19071916
* Retrieves the REST endpoint path for this resource (with no namespace).
19081917
*

tests/service_tests/storagepasswords.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = function(svc) {
2929
function(storagePassword, done) {
3030
test.strictEqual(name, storagePassword.properties().username);
3131
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
32+
test.strictEqual("changeme", storagePassword.properties().clear_password);
3233
test.strictEqual(realm, storagePassword.properties().realm);
3334
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
3435
},
@@ -67,6 +68,7 @@ module.exports = function(svc) {
6768
function(storagePassword, done) {
6869
test.strictEqual(name, storagePassword.properties().username);
6970
test.strictEqual("\\" + realm + ":\\" + name + ":", storagePassword.name);
71+
test.strictEqual("changeme", storagePassword.properties().clear_password);
7072
test.strictEqual(realm, storagePassword.properties().realm);
7173
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
7274
},
@@ -105,6 +107,7 @@ module.exports = function(svc) {
105107
function(storagePassword, done) {
106108
test.strictEqual(name, storagePassword.properties().username);
107109
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
110+
test.strictEqual("changeme", storagePassword.properties().clear_password);
108111
test.strictEqual(realm, storagePassword.properties().realm);
109112
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
110113
},
@@ -142,6 +145,7 @@ module.exports = function(svc) {
142145
function(storagePassword, done) {
143146
test.strictEqual(name, storagePassword.properties().username);
144147
test.strictEqual(":" + name + ":", storagePassword.name);
148+
test.strictEqual("changeme", storagePassword.properties().clear_password);
145149
test.strictEqual("", storagePassword.properties().realm);
146150
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
147151
},
@@ -231,6 +235,7 @@ module.exports = function(svc) {
231235
function(storagePassword, done) {
232236
test.strictEqual(name, storagePassword.properties().username);
233237
test.strictEqual("\\" + realm + ":\\" + name + ":", storagePassword.name);
238+
test.strictEqual("changeme", storagePassword.properties().clear_password);
234239
test.strictEqual(realm, storagePassword.properties().realm);
235240
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
236241
},
@@ -273,6 +278,7 @@ module.exports = function(svc) {
273278
function(storagePassword, done) {
274279
test.strictEqual(name + ":end!@#$%^&*()_+{}:|<>?", storagePassword.properties().username);
275280
test.strictEqual("\\:start\\:\\:!@#$%^&*()_+{}\\:|<>?" + realm + ":" + name + "\\:end!@#$%^&*()_+{}\\:|<>?:", storagePassword.name);
281+
test.strictEqual("changeme", storagePassword.properties().clear_password);
276282
test.strictEqual(":start::!@#$%^&*()_+{}:|<>?" + realm, storagePassword.properties().realm);
277283
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
278284
},
@@ -315,6 +321,7 @@ module.exports = function(svc) {
315321
function(storagePassword, done) {
316322
test.strictEqual(name + ":end!@#$%^&*()_+{}:|<>?쎼 and 쎶 and &lt;&amp;&gt; für", storagePassword.properties().username);
317323
test.strictEqual("\\:start\\:\\:!@#$%^&*()_+{}\\:|<>?" + encodeURIComponent("쎼 and 쎶 and &lt;&amp;&gt; für") + realm + ":" + name + "\\:end!@#$%^&*()_+{}\\:|<>?쎼 and 쎶 and &lt;&amp;&gt; für:", storagePassword.name);
324+
test.strictEqual(decodeURIComponent(encodeURIComponent("쎼 and 쎶 and &lt;&amp;&gt; für")), storagePassword.properties().clear_password);
318325
test.strictEqual(":start::!@#$%^&*()_+{}:|<>?" + encodeURIComponent("쎼 and 쎶 and &lt;&amp;&gt; für") + realm, storagePassword.properties().realm);
319326
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
320327
},
@@ -353,6 +360,7 @@ module.exports = function(svc) {
353360
function(storagePassword, done) {
354361
test.strictEqual(name, storagePassword.properties().username);
355362
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
363+
test.strictEqual("changeme", storagePassword.properties().clear_password);
356364
test.strictEqual(realm, storagePassword.properties().realm);
357365
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
358366
},
@@ -408,6 +416,7 @@ module.exports = function(svc) {
408416
function(storagePassword, done) {
409417
test.strictEqual(name, storagePassword.properties().username);
410418
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
419+
test.strictEqual("changeme", storagePassword.properties().clear_password);
411420
test.strictEqual(realm, storagePassword.properties().realm);
412421
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
413422
},
@@ -463,6 +472,7 @@ module.exports = function(svc) {
463472
function(storagePassword, done) {
464473
test.strictEqual(name, storagePassword.properties().username);
465474
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
475+
test.strictEqual("changeme", storagePassword.properties().clear_password);
466476
test.strictEqual(realm, storagePassword.properties().realm);
467477
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
468478
},
@@ -473,6 +483,7 @@ module.exports = function(svc) {
473483
function(storagePassword, done) {
474484
test.strictEqual(name, storagePassword.properties().username);
475485
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
486+
test.strictEqual("changed", storagePassword.properties().clear_password);
476487
test.strictEqual(realm, storagePassword.properties().realm);
477488
that.service.storagePasswords().fetch(done);
478489
},
@@ -488,6 +499,7 @@ module.exports = function(svc) {
488499
index = i;
489500
test.strictEqual(name, list[i].properties().username);
490501
test.strictEqual(realm + ":" + name + ":", list[i].name);
502+
test.strictEqual("changed", list[i].properties().clear_password);
491503
test.strictEqual(realm, list[i].properties().realm);
492504
}
493505
}
@@ -531,6 +543,7 @@ module.exports = function(svc) {
531543
function(storagePassword, done) {
532544
test.strictEqual(name, storagePassword.properties().username);
533545
test.strictEqual(realm + ":" + name + ":", storagePassword.name);
546+
test.strictEqual("changeme", storagePassword.properties().clear_password);
534547
test.strictEqual(realm, storagePassword.properties().realm);
535548
that.service.storagePasswords().fetch(Async.augment(done, storagePassword));
536549
},
@@ -562,6 +575,7 @@ module.exports = function(svc) {
562575
index = i;
563576
test.strictEqual(name, list[i].properties().username);
564577
test.strictEqual(realm + ":" + name + ":", list[i].name);
578+
test.strictEqual("changeme", list[i].properties().clear_password);
565579
test.strictEqual(realm, list[i].properties().realm);
566580
}
567581
}

0 commit comments

Comments
 (0)