@rockcarver/frodo-lib 0.17.2-0 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/cjs/api/AgentApi.js +1 -1
- package/cjs/api/AgentApi.js.map +1 -1
- package/cjs/api/AgentApi.test.js.map +1 -1
- package/cjs/api/ApiTypes.js +16 -16
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/AuthenticateApi.js +17 -12
- package/cjs/api/AuthenticateApi.js.map +1 -1
- package/cjs/api/AuthenticateApi.test.js.map +1 -1
- package/cjs/api/IdmConfigApi.js +28 -7
- package/cjs/api/IdmConfigApi.js.map +1 -1
- package/cjs/api/NodeApi.test.js.map +1 -1
- package/cjs/api/SecretsApi.test.js.map +1 -1
- package/cjs/api/SocialIdentityProvidersApi.js +22 -0
- package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -1
- package/cjs/api/VariablesApi.test.js.map +1 -1
- package/cjs/api/utils/ApiUtils.js +13 -4
- package/cjs/api/utils/ApiUtils.js.map +1 -1
- package/cjs/api/utils/ApiUtils.test.js.map +1 -1
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AgentOps.test.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +0 -7
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
- package/cjs/ops/IdmOps.test.js.map +1 -1
- package/cjs/ops/IdpOps.js +182 -275
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/IdpOps.test.js.map +1 -1
- package/cjs/ops/SecretsOps.js +3 -3
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/VariablesOps.js +3 -3
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/shared/State.js +1 -1
- package/cjs/shared/State.js.map +1 -1
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/ig_mytestrun_com.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent1.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/{ig_chico.json → FrodoOpsTestGatewayAgent2.json} +0 -2
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/ig_chico.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent3.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/{ig_mytestrun_com.json → FrodoOpsTestGatewayAgent4.json} +0 -2
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/api_client.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent5.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/{api_client.json → FrodoOpsTestGatewayAgent6.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent7.json +20 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent8.json +20 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent9.json +30 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent1.json +30 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent2.json +20 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent3.json +20 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/{javaAgent.json → FrodoOpsTestJavaAgent1.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/{tomcatagent.json → FrodoOpsTestJavaAgent2.json} +0 -2
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/tomcatagent.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent3.json} +0 -2
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/javaAgent.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent4.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent5.json +621 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent6.json +628 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent7.json +628 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent8.json +628 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent9.json +628 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent1.json +621 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent2.json +628 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent3.json +628 -0
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/apacheagent.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent1.json} +0 -2
- package/{esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/webserver.json → cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent2.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/{webserver.json → FrodoOpsTestWebAgent3.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/{apacheagent.json → FrodoOpsTestWebAgent4.json} +0 -2
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent5.json +454 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent6.json +453 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent7.json +453 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent8.json +453 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent9.json +453 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent1.json +454 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent2.json +453 -0
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent3.json +453 -0
- package/cjs/test/mocks/ForgeRockApiMockEngine.js +1 -108
- package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
- package/esm/api/AgentApi.mjs +1 -1
- package/esm/api/AgentApi.test.mjs +323 -246
- package/esm/api/ApiTypes.mjs +16 -16
- package/esm/api/AuthenticateApi.mjs +16 -12
- package/esm/api/AuthenticateApi.test.mjs +77 -35
- package/esm/api/IdmConfigApi.mjs +19 -4
- package/esm/api/NodeApi.test.mjs +248 -914
- package/esm/api/SecretsApi.test.mjs +252 -245
- package/esm/api/SocialIdentityProvidersApi.mjs +16 -0
- package/esm/api/TreeApi.test.mjs +190 -105
- package/esm/api/VariablesApi.test.mjs +108 -12
- package/esm/api/utils/ApiUtils.mjs +12 -4
- package/esm/api/utils/ApiUtils.test.mjs +80 -79
- package/esm/index.mjs +1 -0
- package/esm/ops/AgentOps.test.mjs +780 -1210
- package/esm/ops/AuthenticateOps.mjs +0 -7
- package/esm/ops/ConnectionProfileOps.test.mjs +94 -54
- package/esm/ops/EmailTemplateOps.test.mjs +140 -28
- package/esm/ops/IdmOps.test.mjs +159 -62
- package/esm/ops/IdpOps.mjs +139 -210
- package/esm/ops/IdpOps.test.mjs +651 -52
- package/esm/ops/SecretsOps.mjs +3 -3
- package/esm/ops/VariablesOps.mjs +3 -3
- package/esm/shared/State.mjs +1 -1
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent1.json +30 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent2.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent3.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent4.json +30 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent5.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent6.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent7.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent8.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoOpsTestGatewayAgent9.json +30 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent1.json +30 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent2.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/FrodoTestGatewayAgent3.json +20 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent1.json +621 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent2.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent3.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent4.json +621 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent5.json +621 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent6.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent7.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent8.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoOpsTestJavaAgent9.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent1.json +621 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent2.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/J2EEAgent/FrodoTestJavaAgent3.json +628 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent1.json +454 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent2.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent3.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent4.json +454 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent5.json +454 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent6.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent7.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent8.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoOpsTestWebAgent9.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent1.json +454 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent2.json +453 -0
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/WebAgent/FrodoTestWebAgent3.json +453 -0
- package/esm/test/mocks/ForgeRockApiMockEngine.mjs +1 -98
- package/package.json +1 -1
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +21 -21
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/AuthenticateApi.d.ts +11 -2
- package/types/api/AuthenticateApi.d.ts.map +1 -1
- package/types/api/IdmConfigApi.d.ts +11 -5
- package/types/api/IdmConfigApi.d.ts.map +1 -1
- package/types/api/SocialIdentityProvidersApi.d.ts +7 -0
- package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -1
- package/types/api/utils/ApiUtils.d.ts +7 -1
- package/types/api/utils/ApiUtils.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/IdpOps.d.ts +31 -24
- package/types/ops/IdpOps.d.ts.map +1 -1
- package/types/ops/SecretsOps.d.ts.map +1 -1
- package/types/ops/VariablesOps.d.ts.map +1 -1
- package/types/shared/State.d.ts.map +1 -1
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts +1 -11
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
- package/cjs/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/ajays_client.json +0 -22
- package/esm/test/mocks/AgentApi/getAgentByTypeAndId/IdentityGatewayAgent/ajays_client.json +0 -22
|
@@ -1,261 +1,268 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
/**
|
|
2
|
+
* To record and update snapshots, you must perform 3 steps in order:
|
|
3
|
+
*
|
|
4
|
+
* 1. Record API responses & update ESM snapshots
|
|
5
|
+
*
|
|
6
|
+
* To record and update ESM snapshots, you must call the test:record
|
|
7
|
+
* script and override all the connection state variables required
|
|
8
|
+
* to connect to the env to record from:
|
|
9
|
+
*
|
|
10
|
+
* FRODO_DEBUG=1 FRODO_HOST=volker-dev npm run test:record SecretsApi
|
|
11
|
+
*
|
|
12
|
+
* The above command assumes that you have a connection profile for
|
|
13
|
+
* 'volker-dev' on your development machine.
|
|
14
|
+
*
|
|
15
|
+
* 2. Update CJS snapshots
|
|
16
|
+
*
|
|
17
|
+
* After recording, the ESM snapshots will already be updated as that happens
|
|
18
|
+
* in one go, but you musty manually update the CJS snapshots by running:
|
|
19
|
+
*
|
|
20
|
+
* FRODO_DEBUG=1 npm run test:update SecretsApi
|
|
21
|
+
*
|
|
22
|
+
* 3. Test your changes
|
|
23
|
+
*
|
|
24
|
+
* If 1 and 2 didn't produce any errors, you are ready to run the tests in
|
|
25
|
+
* replay mode and make sure they all succeed as well:
|
|
26
|
+
*
|
|
27
|
+
* npm run test SecretsApi
|
|
28
|
+
*
|
|
29
|
+
* Note: FRODO_DEBUG=1 is optional and enables debug logging for some output
|
|
30
|
+
* in case things don't function as expected
|
|
31
|
+
*/
|
|
32
|
+
import { jest } from '@jest/globals';
|
|
33
|
+
import { SecretsRaw } from '../index';
|
|
34
|
+
import { autoSetupPolly } from '../utils/AutoSetupPolly';
|
|
35
|
+
|
|
36
|
+
// Increase timeout for this test as pipeline keeps failing with error:
|
|
37
|
+
// Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.
|
|
38
|
+
jest.setTimeout(30000);
|
|
39
|
+
autoSetupPolly();
|
|
40
|
+
describe('SecretsApi', () => {
|
|
41
|
+
const secret1 = {
|
|
42
|
+
name: 'esv-frodo-test-secret1',
|
|
43
|
+
value: 'Frodo Test Secret One Value',
|
|
44
|
+
description: 'Frodo Test Secret One Description'
|
|
45
|
+
};
|
|
46
|
+
const secret2 = {
|
|
47
|
+
name: 'esv-frodo-test-secret2',
|
|
48
|
+
value: 'Frodo Test Secret Two Value',
|
|
49
|
+
description: 'Frodo Test Secret Two Description'
|
|
50
|
+
};
|
|
51
|
+
const secret3 = {
|
|
52
|
+
name: 'esv-frodo-test-secret3',
|
|
53
|
+
value: 'Frodo Test Secret Three Value',
|
|
54
|
+
description: 'Frodo Test Secret Three Description'
|
|
55
|
+
};
|
|
56
|
+
const secret4 = {
|
|
57
|
+
name: 'esv-frodo-test-secret4',
|
|
58
|
+
value: 'Frodo Test Secret Four Value',
|
|
59
|
+
description: 'Frodo Test Secret Four Description',
|
|
60
|
+
encoding: 'generic',
|
|
61
|
+
placeholders: true
|
|
62
|
+
};
|
|
63
|
+
// in recording mode, setup test data before recording
|
|
64
|
+
beforeAll(async () => {
|
|
65
|
+
if (process.env.FRODO_POLLY_MODE === 'record') {
|
|
66
|
+
// setup secret1 - delete if exists, then create
|
|
67
|
+
try {
|
|
68
|
+
await SecretsRaw.getSecret(secret1.name);
|
|
69
|
+
await SecretsRaw.deleteSecret(secret1.name);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
// ignore
|
|
72
|
+
} finally {
|
|
73
|
+
await SecretsRaw.putSecret(secret1.name, secret1.value, secret1.description);
|
|
74
|
+
await SecretsRaw.createNewVersionOfSecret(secret1.name, secret1.value + ' Version 2');
|
|
75
|
+
await SecretsRaw.createNewVersionOfSecret(secret1.name, secret1.value + ' Version 3');
|
|
76
|
+
await SecretsRaw.setStatusOfVersionOfSecret(secret1.name, '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
77
|
+
}
|
|
78
|
+
// setup secret2 - delete if exists, then create
|
|
79
|
+
try {
|
|
80
|
+
await SecretsRaw.getSecret(secret2.name);
|
|
81
|
+
await SecretsRaw.deleteSecret(secret2.name);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
// ignore
|
|
84
|
+
} finally {
|
|
85
|
+
await SecretsRaw.putSecret(secret2.name, secret2.value, secret2.description);
|
|
86
|
+
await SecretsRaw.createNewVersionOfSecret(secret2.name, secret2.value + ' Version 2');
|
|
87
|
+
await SecretsRaw.createNewVersionOfSecret(secret2.name, secret2.value + ' Version 3');
|
|
88
|
+
}
|
|
89
|
+
// setup secret3 - delete if exists, then create
|
|
90
|
+
try {
|
|
91
|
+
await SecretsRaw.getSecret(secret3.name);
|
|
92
|
+
await SecretsRaw.deleteSecret(secret3.name);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
// ignore
|
|
95
|
+
} finally {
|
|
96
|
+
await SecretsRaw.putSecret(secret3.name, secret3.value, secret3.description);
|
|
97
|
+
}
|
|
98
|
+
// setup secret4 - delete if exists
|
|
99
|
+
try {
|
|
100
|
+
await SecretsRaw.getSecret(secret4.name);
|
|
101
|
+
await SecretsRaw.deleteSecret(secret4.name);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
// ignore
|
|
104
|
+
}
|
|
31
105
|
}
|
|
32
106
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
107
|
+
// in recording mode, remove test data after recording
|
|
108
|
+
afterAll(async () => {
|
|
109
|
+
if (process.env.FRODO_POLLY_MODE === 'record') {
|
|
110
|
+
try {
|
|
111
|
+
await SecretsRaw.getSecret(secret1.name);
|
|
112
|
+
await SecretsRaw.deleteSecret(secret1.name);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
// ignore
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
await SecretsRaw.getSecret(secret2.name);
|
|
118
|
+
await SecretsRaw.deleteSecret(secret2.name);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
// ignore
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
await SecretsRaw.getSecret(secret3.name);
|
|
124
|
+
await SecretsRaw.deleteSecret(secret3.name);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
// ignore
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
await SecretsRaw.getSecret(secret4.name);
|
|
130
|
+
await SecretsRaw.deleteSecret(secret4.name);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
// ignore
|
|
133
|
+
}
|
|
52
134
|
}
|
|
53
135
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
136
|
+
describe('getSecrets()', () => {
|
|
137
|
+
test('0: Method is implemented', async () => {
|
|
138
|
+
expect(SecretsRaw.getSecrets).toBeDefined();
|
|
139
|
+
});
|
|
140
|
+
test('1: Get all secrets - success', async () => {
|
|
141
|
+
const response = await SecretsRaw.getSecrets();
|
|
142
|
+
expect(response).toMatchSnapshot();
|
|
143
|
+
});
|
|
62
144
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
145
|
+
describe('getSecret()', () => {
|
|
146
|
+
test('0: Method is implemented', async () => {
|
|
147
|
+
expect(SecretsRaw.getSecret).toBeDefined();
|
|
148
|
+
});
|
|
149
|
+
test(`1: Get existing secret: ${secret1.name}`, async () => {
|
|
150
|
+
const response = await SecretsRaw.getSecret(secret1.name);
|
|
151
|
+
expect(response).toMatchSnapshot();
|
|
152
|
+
});
|
|
153
|
+
test('2: Get non-existing secret: esv-does-not-exist', async () => {
|
|
154
|
+
expect.assertions(1);
|
|
155
|
+
try {
|
|
156
|
+
await SecretsRaw.getSecret('esv-does-not-exist');
|
|
157
|
+
} catch (error) {
|
|
158
|
+
expect(error).toMatchSnapshot();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
72
161
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
162
|
+
describe('putSecret()', () => {
|
|
163
|
+
test('0: Method is implemented', async () => {
|
|
164
|
+
expect(SecretsRaw.putSecret).toBeDefined();
|
|
165
|
+
});
|
|
166
|
+
test(`1: Create secret: ${secret4.name} - success`, async () => {
|
|
167
|
+
const response = await SecretsRaw.putSecret(secret4.name, secret4.value, secret4.description, secret4.encoding, secret4.placeholders);
|
|
168
|
+
expect(response).toMatchSnapshot();
|
|
169
|
+
});
|
|
80
170
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
await SecretsRaw.setSecretDescription(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
expect(error).toBeTruthy();
|
|
90
|
-
expect(error.response.status).toBe(500);
|
|
91
|
-
expect(error.response.data.code).toBe(500);
|
|
92
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
93
|
-
}
|
|
171
|
+
describe('setSecretDescription()', () => {
|
|
172
|
+
test('0: Method is implemented', async () => {
|
|
173
|
+
expect(SecretsRaw.setSecretDescription).toBeDefined();
|
|
174
|
+
});
|
|
175
|
+
test(`1: Set existing secret's description: ${secret2.name} - success`, async () => {
|
|
176
|
+
const response = await SecretsRaw.setSecretDescription(secret2.name, 'Updated Frodo Test Secret Two Description');
|
|
177
|
+
expect(response).toMatchSnapshot();
|
|
178
|
+
});
|
|
94
179
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
180
|
+
describe('deleteSecret()', () => {
|
|
181
|
+
test('0: Method is implemented', async () => {
|
|
182
|
+
expect(SecretsRaw.deleteSecret).toBeDefined();
|
|
183
|
+
});
|
|
184
|
+
test(`1: Delete existing secret: ${secret3.name} - success`, async () => {
|
|
185
|
+
const response = await SecretsRaw.deleteSecret(secret3.name);
|
|
186
|
+
expect(response).toMatchSnapshot();
|
|
187
|
+
});
|
|
103
188
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await SecretsRaw.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
expect
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
189
|
+
describe('getSecretVersions()', () => {
|
|
190
|
+
test('0: Method is implemented', async () => {
|
|
191
|
+
expect(SecretsRaw.getSecretVersions).toBeDefined();
|
|
192
|
+
});
|
|
193
|
+
test(`1: Get versions of existing secret: ${secret1.name}`, async () => {
|
|
194
|
+
const response = await SecretsRaw.getSecretVersions(secret1.name);
|
|
195
|
+
expect(response).toMatchSnapshot();
|
|
196
|
+
});
|
|
197
|
+
test('2: Get versions of non-existing secret: esv-does-not-exist', async () => {
|
|
198
|
+
expect.assertions(1);
|
|
199
|
+
try {
|
|
200
|
+
await SecretsRaw.getSecretVersions('esv-does-not-exist');
|
|
201
|
+
} catch (error) {
|
|
202
|
+
expect(error).toMatchSnapshot();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
117
205
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
206
|
+
describe('getVersionOfSecret()', () => {
|
|
207
|
+
test('0: Method is implemented', async () => {
|
|
208
|
+
expect(SecretsRaw.getVersionOfSecret).toBeDefined();
|
|
209
|
+
});
|
|
210
|
+
test(`1: Get version 2 of existing secret: ${secret1.name}`, async () => {
|
|
211
|
+
const response = await SecretsRaw.getVersionOfSecret(secret1.name, '2');
|
|
212
|
+
expect(response).toMatchSnapshot();
|
|
213
|
+
});
|
|
214
|
+
test('2: Get version 2 of non-existing secret: esv-does-not-exist', async () => {
|
|
215
|
+
expect.assertions(1);
|
|
216
|
+
try {
|
|
217
|
+
await SecretsRaw.getVersionOfSecret('esv-does-not-exist', '2');
|
|
218
|
+
} catch (error) {
|
|
219
|
+
expect(error).toMatchSnapshot();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
126
222
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
await SecretsRaw.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
expect
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
223
|
+
describe('createNewVersionOfSecret()', () => {
|
|
224
|
+
test('0: Method is implemented', async () => {
|
|
225
|
+
expect(SecretsRaw.createNewVersionOfSecret).toBeDefined();
|
|
226
|
+
});
|
|
227
|
+
test(`1: Create new version of existing secret: ${secret2.name} - success`, async () => {
|
|
228
|
+
const response = await SecretsRaw.createNewVersionOfSecret(secret2.name, secret2.value + ' Version 4');
|
|
229
|
+
expect(response).toMatchSnapshot();
|
|
230
|
+
});
|
|
231
|
+
test('2: Create new version of non-existing secret: esv-does-not-exist - error', async () => {
|
|
232
|
+
expect.assertions(1);
|
|
233
|
+
try {
|
|
234
|
+
await SecretsRaw.createNewVersionOfSecret('esv-does-not-exist', 'Frodo Non-Existing Test Secret Value Version 2');
|
|
235
|
+
} catch (error) {
|
|
236
|
+
expect(error).toMatchSnapshot();
|
|
237
|
+
}
|
|
238
|
+
});
|
|
140
239
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
240
|
+
describe('setStatusOfVersionOfSecret()', () => {
|
|
241
|
+
test('0: Method is implemented', async () => {
|
|
242
|
+
expect(SecretsRaw.setStatusOfVersionOfSecret).toBeDefined();
|
|
243
|
+
});
|
|
244
|
+
test(`1: Disable version 2 of existing secret: ${secret2.name} - success`, async () => {
|
|
245
|
+
expect.assertions(1);
|
|
246
|
+
const response = await SecretsRaw.setStatusOfVersionOfSecret(secret2.name, '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
247
|
+
expect(response).toMatchSnapshot();
|
|
248
|
+
});
|
|
249
|
+
test('2: Disable version 2 of non-existing secret: esv-does-not-exist - error', async () => {
|
|
250
|
+
expect.assertions(1);
|
|
251
|
+
try {
|
|
252
|
+
await SecretsRaw.setStatusOfVersionOfSecret('esv-does-not-exist', '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
253
|
+
} catch (error) {
|
|
254
|
+
expect(error).toMatchSnapshot();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
149
257
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
await SecretsRaw.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
expect(error).toBeTruthy();
|
|
159
|
-
expect(error.response.status).toBe(500);
|
|
160
|
-
expect(error.response.data.code).toBe(500);
|
|
161
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
test('createNewVersionOfSecret() 3: Create new version of non-existing secret: esv-does-not-exist - error', async () => {
|
|
165
|
-
const mockResponse = fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/createNewVersionOfSecret/esv-does-not-exist.txt'), 'utf8');
|
|
166
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions?_action=create').reply(500, mockResponse);
|
|
167
|
-
expect.assertions(3);
|
|
168
|
-
try {
|
|
169
|
-
await SecretsRaw.createNewVersionOfSecret('esv-volkerstestsecret1', "Volker's Test Secret Value");
|
|
170
|
-
} catch (error) {
|
|
171
|
-
// console.dir(error);
|
|
172
|
-
expect(error).toBeTruthy();
|
|
173
|
-
expect(error.response.status).toBe(500);
|
|
174
|
-
expect(error.response.data).toBe(mockResponse);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
describe('SecretsApi - getVersionOfSecret()', () => {
|
|
179
|
-
test('getVersionOfSecret() 1: Get version 2 of existing secret: esv-volkerstestsecret1', async () => {
|
|
180
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/getVersionOfSecret/esv-volkerstestsecret1_v2.json'), 'utf8'));
|
|
181
|
-
mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions/2').reply(200, mockResponse);
|
|
182
|
-
const response = await SecretsRaw.getVersionOfSecret('esv-volkerstestsecret1', '2');
|
|
183
|
-
expect(response).toBeTruthy();
|
|
184
|
-
expect(response).toMatchObject(mockResponse);
|
|
185
|
-
});
|
|
186
|
-
test('getVersionOfSecret() 2: Get version 2 of non-existing secret: esv-does-not-exist', async () => {
|
|
187
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/getVersionOfSecret/esv-does-not-exist_v2.json'), 'utf8'));
|
|
188
|
-
mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-does-not-exist/versions/2').reply(500, mockResponse);
|
|
189
|
-
expect.assertions(4);
|
|
190
|
-
try {
|
|
191
|
-
await SecretsRaw.getVersionOfSecret('esv-does-not-exist', '2');
|
|
192
|
-
} catch (error) {
|
|
193
|
-
// console.dir(error);
|
|
194
|
-
expect(error).toBeTruthy();
|
|
195
|
-
expect(error.response.status).toBe(500);
|
|
196
|
-
expect(error.response.data.code).toBe(500);
|
|
197
|
-
expect(error.response.data.message).toBe('Failed to update secret version');
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
describe('SecretsApi - setStatusOfVersionOfSecret()', () => {
|
|
202
|
-
test('setStatusOfVersionOfSecret() 1: Disable version 2 of existing secret: esv-volkerstestsecret1 - success', async () => {
|
|
203
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/setStatusOfVersionOfSecret/esv-volkerstestsecret1_v2_DISABLED.json'), 'utf8'));
|
|
204
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions/2?_action=changestatus').reply(200, mockResponse);
|
|
205
|
-
const response = await SecretsRaw.setStatusOfVersionOfSecret('esv-volkerstestsecret1', '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
206
|
-
expect(response).toBeTruthy();
|
|
207
|
-
expect(response).toMatchObject(mockResponse);
|
|
208
|
-
});
|
|
209
|
-
test('setStatusOfVersionOfSecret() 2: Disable version 2 of existing secret: esv-volkerstestsecret1 - error', async () => {
|
|
210
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/setStatusOfVersionOfSecret/error.json'), 'utf8'));
|
|
211
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions/2?_action=changestatus').reply(500, mockResponse);
|
|
212
|
-
expect.assertions(4);
|
|
213
|
-
try {
|
|
214
|
-
await SecretsRaw.setStatusOfVersionOfSecret('esv-volkerstestsecret1', '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
215
|
-
} catch (error) {
|
|
216
|
-
// console.dir(error);
|
|
217
|
-
expect(error).toBeTruthy();
|
|
218
|
-
expect(error.response.status).toBe(500);
|
|
219
|
-
expect(error.response.data.code).toBe(500);
|
|
220
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
test('setStatusOfVersionOfSecret() 3: Disable version 2 of non-existing secret: esv-does-not-exist - error', async () => {
|
|
224
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/setStatusOfVersionOfSecret/esv-does-not-exist_v2_DISABLED.json'), 'utf8'));
|
|
225
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-does-not-exist/versions/2?_action=changestatus').reply(404, mockResponse);
|
|
226
|
-
expect.assertions(4);
|
|
227
|
-
try {
|
|
228
|
-
await SecretsRaw.setStatusOfVersionOfSecret('esv-does-not-exist', '2', SecretsRaw.VersionOfSecretStatus.DISABLED);
|
|
229
|
-
} catch (error) {
|
|
230
|
-
// console.dir(error);
|
|
231
|
-
expect(error).toBeTruthy();
|
|
232
|
-
expect(error.response.status).toBe(404);
|
|
233
|
-
expect(error.response.data.code).toBe(404);
|
|
234
|
-
expect(error.response.data.message).toBe('The secret does not exist or does not have a version');
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
describe('SecretsApi - deleteVersionOfSecret()', () => {
|
|
239
|
-
test('deleteVersionOfSecret() 1: Delete version 2 of secret: esv-volkerstestsecret1 - success', async () => {
|
|
240
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/deleteVersionOfSecret/esv-volkerstestsecret1_v2.json'), 'utf8'));
|
|
241
|
-
mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions/2').reply(200, mockResponse);
|
|
242
|
-
const response = await SecretsRaw.deleteVersionOfSecret('esv-volkerstestsecret1', '2');
|
|
243
|
-
expect(response).toBeTruthy();
|
|
244
|
-
expect(response).toMatchObject(mockResponse);
|
|
245
|
-
});
|
|
246
|
-
test('deleteVersionOfSecret() 2: Delete version 2 of secret: esv-volkerstestsecret1 - error', async () => {
|
|
247
|
-
const mockResponse = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/SecretsApi/deleteVersionOfSecret/error.json'), 'utf8'));
|
|
248
|
-
mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/secrets/esv-volkerstestsecret1/versions/2').reply(500, mockResponse);
|
|
249
|
-
expect.assertions(4);
|
|
250
|
-
try {
|
|
251
|
-
await SecretsRaw.deleteVersionOfSecret('esv-volkerstestsecret1', '2');
|
|
252
|
-
} catch (error) {
|
|
253
|
-
// console.dir(error);
|
|
254
|
-
expect(error).toBeTruthy();
|
|
255
|
-
expect(error.response.status).toBe(500);
|
|
256
|
-
expect(error.response.data.code).toBe(500);
|
|
257
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
258
|
-
}
|
|
258
|
+
describe('deleteVersionOfSecret()', () => {
|
|
259
|
+
test('0: Method is implemented', async () => {
|
|
260
|
+
expect(SecretsRaw.deleteVersionOfSecret).toBeDefined();
|
|
261
|
+
});
|
|
262
|
+
test(`1: Delete version 1 of secret: ${secret2.name} - success`, async () => {
|
|
263
|
+
const response = await SecretsRaw.deleteVersionOfSecret(secret2.name, '1');
|
|
264
|
+
expect(response).toMatchSnapshot();
|
|
265
|
+
});
|
|
259
266
|
});
|
|
260
267
|
});
|
|
261
268
|
//# sourceMappingURL=SecretsApi.test.js.map
|
|
@@ -93,4 +93,20 @@ export async function putProviderByTypeAndId(type, id, providerData) {
|
|
|
93
93
|
});
|
|
94
94
|
return data;
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Delete social identity provider by type and id
|
|
99
|
+
* @param {string} providerId provider type
|
|
100
|
+
* @param {string} providerId provider id
|
|
101
|
+
* @returns {Promise<unknown>} a promise that resolves to a social identity provider
|
|
102
|
+
*/
|
|
103
|
+
export async function deleteProviderByTypeAndId(type, providerId) {
|
|
104
|
+
const urlString = util.format(providerByTypeAndIdURLTemplate, state.getHost(), getCurrentRealmPath(), type, providerId);
|
|
105
|
+
const {
|
|
106
|
+
data
|
|
107
|
+
} = await generateAmApi(getApiConfig()).delete(urlString, {
|
|
108
|
+
withCredentials: true
|
|
109
|
+
});
|
|
110
|
+
return data;
|
|
111
|
+
}
|
|
96
112
|
//# sourceMappingURL=SocialIdentityProvidersApi.js.map
|