@rockcarver/frodo-lib 0.16.2-9 → 0.17.1
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 +222 -1
- package/cjs/api/AgentApi.js +14 -61
- package/cjs/api/AgentApi.js.map +1 -1
- package/cjs/api/AgentApi.test.js.map +1 -1
- package/cjs/api/ApiTypes.js +0 -5
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/AuthenticateApi.js +9 -20
- package/cjs/api/AuthenticateApi.js.map +1 -1
- package/cjs/api/AuthenticateApi.test.js.map +1 -0
- package/cjs/api/BaseApi.js +82 -124
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/CirclesOfTrustApi.js +8 -32
- package/cjs/api/CirclesOfTrustApi.js.map +1 -1
- package/cjs/api/IdmConfigApi.js +9 -34
- package/cjs/api/IdmConfigApi.js.map +1 -1
- package/cjs/api/LogApi.js +8 -31
- package/cjs/api/LogApi.js.map +1 -1
- package/cjs/api/ManagedObjectApi.js +34 -31
- package/cjs/api/ManagedObjectApi.js.map +1 -1
- package/cjs/api/NodeApi.js +10 -41
- package/cjs/api/NodeApi.js.map +1 -1
- package/cjs/api/NodeApi.test.js.map +1 -1
- package/cjs/api/OAuth2ClientApi.js +7 -26
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.js +28 -34
- package/cjs/api/OAuth2OIDCApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.test.js.map +1 -0
- package/cjs/api/OAuth2ProviderApi.js +5 -15
- package/cjs/api/OAuth2ProviderApi.js.map +1 -1
- package/cjs/api/RealmApi.js +8 -34
- package/cjs/api/RealmApi.js.map +1 -1
- package/cjs/api/Saml2Api.js +16 -67
- package/cjs/api/Saml2Api.js.map +1 -1
- package/cjs/api/ScriptApi.js +8 -30
- package/cjs/api/ScriptApi.js.map +1 -1
- package/cjs/api/SecretsApi.js +14 -64
- package/cjs/api/SecretsApi.js.map +1 -1
- package/cjs/api/SecretsApi.test.js.map +1 -1
- package/cjs/api/ServerInfoApi.js +6 -21
- package/cjs/api/ServerInfoApi.js.map +1 -1
- package/cjs/api/ServiceApi.js +49 -47
- package/cjs/api/ServiceApi.js.map +1 -1
- package/cjs/api/SocialIdentityProvidersApi.js +9 -36
- package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
- package/cjs/api/StartupApi.js +5 -24
- package/cjs/api/StartupApi.js.map +1 -1
- package/cjs/api/StartupApi.test.js.map +1 -1
- package/cjs/api/TreeApi.js +8 -30
- package/cjs/api/TreeApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -1
- package/cjs/api/VariablesApi.js +9 -37
- package/cjs/api/VariablesApi.js.map +1 -1
- package/cjs/api/VariablesApi.test.js.map +1 -1
- package/cjs/api/utils/ApiUtils.js +47 -57
- package/cjs/api/utils/ApiUtils.js.map +1 -1
- package/cjs/api/utils/ApiUtils.test.js.map +1 -1
- package/cjs/api/utils/Base64.js +5 -15
- package/cjs/api/utils/Base64.js.map +1 -1
- package/cjs/ext/axios-curlirize/curlirize.js +2 -9
- package/cjs/ext/axios-curlirize/curlirize.js.map +1 -1
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js +7 -22
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js.map +1 -1
- package/cjs/index.js +30 -89
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AdminOps.js +27 -165
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AgentOps.js +2 -159
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/AgentOps.test.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +266 -226
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.test.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +13 -91
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +220 -136
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +35 -379
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
- package/cjs/ops/IdmOps.js +52 -426
- package/cjs/ops/IdmOps.js.map +1 -1
- package/cjs/ops/IdmOps.test.js.map +1 -1
- package/cjs/ops/IdpOps.js +11 -94
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/IdpOps.test.js.map +1 -1
- package/cjs/ops/JoseOps.js +81 -0
- package/cjs/ops/JoseOps.js.map +1 -0
- package/cjs/ops/JoseOps.test.js.map +1 -0
- package/cjs/ops/JourneyOps.js +139 -370
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/JourneyOps.test.js.map +1 -1
- package/cjs/ops/LogOps.js +14 -47
- package/cjs/ops/LogOps.js.map +1 -1
- package/cjs/ops/ManagedObjectOps.js +4 -12
- package/cjs/ops/ManagedObjectOps.js.map +1 -1
- package/cjs/ops/NodeOps.js +9 -67
- package/cjs/ops/NodeOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +10 -40
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OpsTypes.js +0 -5
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/ops/OrganizationOps.js +6 -25
- package/cjs/ops/OrganizationOps.js.map +1 -1
- package/cjs/ops/RealmOps.js +0 -19
- package/cjs/ops/RealmOps.js.map +1 -1
- package/cjs/ops/Saml2Ops.js +11 -107
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +26 -73
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/SecretsOps.js +2 -58
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/ServiceAccountOps.js +61 -0
- package/cjs/ops/ServiceAccountOps.js.map +1 -0
- package/cjs/ops/ServiceAccountOps.test.js.map +1 -0
- package/cjs/ops/ServiceOps.js +55 -101
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/ops/StartupOps.js +2 -23
- package/cjs/ops/StartupOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +230 -436
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/ThemeOps.test.js.map +1 -0
- package/cjs/ops/VariablesOps.js +0 -38
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +29 -62
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/DataProtection.js +13 -47
- package/cjs/ops/utils/DataProtection.js.map +1 -1
- package/cjs/ops/utils/DataProtection.test.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +36 -74
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.js +27 -43
- package/cjs/ops/utils/OpsUtils.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.test.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.js +0 -13
- package/cjs/ops/utils/ValidationUtils.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.test.js.map +1 -1
- package/cjs/ops/utils/Version.js +2 -12
- package/cjs/ops/utils/Version.js.map +1 -1
- package/cjs/ops/utils/Version.test.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.js +1 -2
- package/cjs/ops/utils/Wordwrap.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.test.js.map +1 -0
- package/cjs/shared/State.js +239 -0
- package/cjs/shared/State.js.map +1 -0
- package/cjs/shared/State.test.js.map +1 -0
- package/cjs/storage/StaticStorage.js.map +1 -1
- package/cjs/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/cjs/test/mocks/ForgeRockApiMockEngine.js +161 -83
- package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
- package/cjs/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/cjs/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/cjs/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/cjs/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/cjs/utils/AutoSetupPolly.js +79 -0
- package/cjs/utils/AutoSetupPolly.js.map +1 -0
- package/cjs/utils/SetupJest.js +6 -0
- package/cjs/utils/SetupJest.js.map +1 -0
- package/cjs/{test/mocks → utils}/snapshotResolve.js +10 -12
- package/cjs/utils/snapshotResolve.js.map +1 -0
- package/esm/api/AgentApi.mjs +19 -21
- package/esm/api/AgentApi.test.mjs +6 -15
- package/esm/api/ApiTypes.mjs +0 -5
- package/esm/api/AuthenticateApi.mjs +7 -10
- package/esm/api/AuthenticateApi.test.mjs +39 -0
- package/esm/api/BaseApi.mjs +96 -81
- package/esm/api/CirclesOfTrustApi.mjs +9 -12
- package/esm/api/IdmConfigApi.mjs +11 -12
- package/esm/api/LogApi.mjs +6 -10
- package/esm/api/ManagedObjectApi.mjs +23 -8
- package/esm/api/NodeApi.mjs +13 -15
- package/esm/api/NodeApi.test.mjs +13 -17
- package/esm/api/OAuth2ClientApi.mjs +7 -9
- package/esm/api/OAuth2OIDCApi.mjs +15 -9
- package/esm/api/OAuth2OIDCApi.test.mjs +53 -0
- package/esm/api/OAuth2ProviderApi.mjs +3 -5
- package/esm/api/RealmApi.mjs +10 -13
- package/esm/api/Saml2Api.mjs +25 -29
- package/esm/api/ScriptApi.mjs +9 -11
- package/esm/api/SecretsApi.mjs +21 -24
- package/esm/api/SecretsApi.test.mjs +9 -31
- package/esm/api/ServerInfoApi.mjs +5 -9
- package/esm/api/ServiceApi.mjs +53 -26
- package/esm/api/SocialIdentityProvidersApi.mjs +11 -13
- package/esm/api/StartupApi.mjs +5 -10
- package/esm/api/StartupApi.test.mjs +4 -7
- package/esm/api/TreeApi.mjs +9 -11
- package/esm/api/TreeApi.test.mjs +24 -61
- package/esm/api/VariablesApi.mjs +11 -13
- package/esm/api/VariablesApi.test.mjs +80 -222
- package/esm/api/utils/ApiUtils.mjs +45 -48
- package/esm/api/utils/ApiUtils.test.mjs +33 -32
- package/esm/api/utils/Base64.mjs +5 -9
- package/esm/ext/axios-curlirize/curlirize.mjs +2 -7
- package/esm/ext/axios-curlirize/lib/CurlHelper.mjs +7 -20
- package/esm/index.mjs +23 -13
- package/esm/ops/AdminOps.mjs +33 -119
- package/esm/ops/AgentOps.mjs +37 -80
- package/esm/ops/AgentOps.test.mjs +5 -45
- package/esm/ops/AuthenticateOps.mjs +242 -175
- package/esm/ops/AuthenticateOps.test.mjs +7 -9
- package/esm/ops/CirclesOfTrustOps.mjs +24 -61
- package/esm/ops/ConnectionProfileOps.mjs +192 -82
- package/esm/ops/ConnectionProfileOps.test.mjs +19 -19
- package/esm/ops/EmailTemplateOps.mjs +18 -276
- package/esm/ops/EmailTemplateOps.test.mjs +19 -44
- package/esm/ops/IdmOps.mjs +30 -327
- package/esm/ops/IdmOps.test.mjs +47 -54
- package/esm/ops/IdpOps.mjs +21 -59
- package/esm/ops/IdpOps.test.mjs +5 -5
- package/esm/ops/JoseOps.mjs +41 -0
- package/esm/ops/JoseOps.test.mjs +137 -0
- package/esm/ops/JourneyOps.mjs +146 -289
- package/esm/ops/JourneyOps.test.mjs +29 -27
- package/esm/ops/LogOps.mjs +15 -25
- package/esm/ops/ManagedObjectOps.mjs +6 -6
- package/esm/ops/NodeOps.mjs +9 -47
- package/esm/ops/OAuth2ClientOps.mjs +13 -19
- package/esm/ops/OpsTypes.mjs +1 -3
- package/esm/ops/OrganizationOps.mjs +7 -14
- package/esm/ops/RealmOps.mjs +4 -7
- package/esm/ops/Saml2Ops.mjs +28 -62
- package/esm/ops/Saml2Ops.test.mjs +20 -23
- package/esm/ops/ScriptOps.mjs +29 -47
- package/esm/ops/SecretsOps.mjs +15 -31
- package/esm/ops/ServiceAccountOps.mjs +41 -0
- package/esm/ops/ServiceAccountOps.test.mjs +51 -0
- package/esm/ops/ServiceOps.mjs +66 -83
- package/esm/ops/StartupOps.mjs +4 -13
- package/esm/ops/ThemeOps.mjs +189 -298
- package/esm/{api/ThemeApi.test.mjs → ops/ThemeOps.test.mjs} +91 -96
- package/esm/ops/VariablesOps.mjs +9 -18
- package/esm/ops/utils/Console.mjs +28 -46
- package/esm/ops/utils/DataProtection.mjs +15 -28
- package/esm/ops/utils/DataProtection.test.mjs +8 -8
- package/esm/ops/utils/ExportImportUtils.mjs +34 -43
- package/esm/ops/utils/ExportImportUtils.test.mjs +20 -18
- package/esm/ops/utils/OpsUtils.mjs +27 -21
- package/esm/ops/utils/OpsUtils.test.mjs +155 -27
- package/esm/ops/utils/ValidationUtils.mjs +0 -9
- package/esm/ops/utils/Version.mjs +2 -3
- package/esm/ops/utils/Version.test.mjs +0 -2
- package/esm/ops/utils/Wordwrap.mjs +1 -1
- package/esm/ops/utils/Wordwrap.test.mjs +19 -0
- package/esm/shared/State.mjs +164 -0
- package/esm/shared/State.test.mjs +249 -0
- package/esm/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/esm/test/mocks/ForgeRockApiMockEngine.mjs +147 -31
- package/esm/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/esm/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/esm/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/esm/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/esm/utils/AutoSetupPolly.mjs +72 -0
- package/esm/utils/SetupJest.mjs +3 -0
- package/esm/{test/mocks → utils}/snapshotResolve.mjs +10 -12
- package/package.json +36 -26
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +15 -16
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/AuthenticateApi.d.ts +1 -1
- package/types/api/AuthenticateApi.d.ts.map +1 -1
- package/types/api/BaseApi.d.ts +2 -0
- package/types/api/BaseApi.d.ts.map +1 -1
- package/types/api/CirclesOfTrustApi.d.ts.map +1 -1
- package/types/api/IdmConfigApi.d.ts.map +1 -1
- package/types/api/LogApi.d.ts.map +1 -1
- package/types/api/ManagedObjectApi.d.ts +9 -1
- package/types/api/ManagedObjectApi.d.ts.map +1 -1
- package/types/api/NodeApi.d.ts.map +1 -1
- package/types/api/OAuth2ClientApi.d.ts.map +1 -1
- package/types/api/OAuth2OIDCApi.d.ts +4 -2
- package/types/api/OAuth2OIDCApi.d.ts.map +1 -1
- package/types/api/OAuth2ProviderApi.d.ts.map +1 -1
- package/types/api/RealmApi.d.ts.map +1 -1
- package/types/api/Saml2Api.d.ts.map +1 -1
- package/types/api/ScriptApi.d.ts.map +1 -1
- package/types/api/SecretsApi.d.ts.map +1 -1
- package/types/api/ServerInfoApi.d.ts.map +1 -1
- package/types/api/ServiceApi.d.ts +14 -7
- package/types/api/ServiceApi.d.ts.map +1 -1
- package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -1
- package/types/api/StartupApi.d.ts.map +1 -1
- package/types/api/TreeApi.d.ts.map +1 -1
- package/types/api/VariablesApi.d.ts.map +1 -1
- package/types/api/utils/ApiUtils.d.ts +1 -0
- package/types/api/utils/ApiUtils.d.ts.map +1 -1
- package/types/index.d.ts +11 -5
- package/types/index.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts +10 -2
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts +49 -21
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/EmailTemplateOps.d.ts +14 -33
- package/types/ops/EmailTemplateOps.d.ts.map +1 -1
- package/types/ops/IdmOps.d.ts +29 -37
- package/types/ops/IdmOps.d.ts.map +1 -1
- package/types/ops/JoseOps.d.ts +33 -0
- package/types/ops/JoseOps.d.ts.map +1 -0
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/LogOps.d.ts.map +1 -1
- package/types/ops/NodeOps.d.ts.map +1 -1
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +1 -1
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/OrganizationOps.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/ops/ServiceAccountOps.d.ts +20 -0
- package/types/ops/ServiceAccountOps.d.ts.map +1 -0
- package/types/ops/ServiceOps.d.ts +18 -10
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts +35 -50
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/utils/Console.d.ts +1 -1
- package/types/ops/utils/Console.d.ts.map +1 -1
- package/types/ops/utils/DataProtection.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +5 -2
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/ops/utils/OpsUtils.d.ts +6 -0
- package/types/ops/utils/OpsUtils.d.ts.map +1 -1
- package/types/ops/utils/Wordwrap.d.ts.map +1 -1
- package/types/shared/State.d.ts +223 -0
- package/types/shared/State.d.ts.map +1 -0
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts +19 -1
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
- package/types/utils/AutoSetupPolly.d.ts +1 -0
- package/types/utils/AutoSetupPolly.d.ts.map +1 -0
- package/types/utils/SetupJest.d.ts +1 -0
- package/types/utils/SetupJest.d.ts.map +1 -0
- package/types/utils/snapshotResolve.d.ts +1 -0
- package/types/utils/snapshotResolve.d.ts.map +1 -0
- package/cjs/api/EmailTemplateApi.js +0 -73
- package/cjs/api/EmailTemplateApi.js.map +0 -1
- package/cjs/api/ThemeApi.js +0 -367
- package/cjs/api/ThemeApi.js.map +0 -1
- package/cjs/api/ThemeApi.test.js.map +0 -1
- package/cjs/storage/SessionStorage.js +0 -91
- package/cjs/storage/SessionStorage.js.map +0 -1
- package/cjs/test/mocks/snapshotResolve.js.map +0 -1
- package/esm/api/EmailTemplateApi.mjs +0 -34
- package/esm/api/ThemeApi.mjs +0 -271
- package/esm/storage/SessionStorage.mjs +0 -79
- package/types/api/EmailTemplateApi.d.ts +0 -22
- package/types/api/EmailTemplateApi.d.ts.map +0 -1
- package/types/api/ThemeApi.d.ts +0 -56
- package/types/api/ThemeApi.d.ts.map +0 -1
- package/types/storage/SessionStorage.d.ts +0 -71
- package/types/storage/SessionStorage.d.ts.map +0 -1
- package/types/test/mocks/snapshotResolve.d.ts +0 -1
- package/types/test/mocks/snapshotResolve.d.ts.map +0 -1
package/esm/api/TreeApi.test.mjs
CHANGED
|
@@ -4,24 +4,22 @@ import { TreeRaw, state } from '../index';
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
|
|
10
8
|
const mock = new MockAdapter(axios);
|
|
11
|
-
state.
|
|
12
|
-
state.
|
|
13
|
-
state.
|
|
14
|
-
state.
|
|
9
|
+
state.setHost('');
|
|
10
|
+
state.setRealm('alpha');
|
|
11
|
+
state.setCookieName('cookieName');
|
|
12
|
+
state.setCookieValue('cookieValue');
|
|
15
13
|
describe('TreeApi - getTrees()', () => {
|
|
16
14
|
test('getTrees() 0: Method is implemented', async () => {
|
|
17
15
|
expect(TreeRaw.getTrees).toBeDefined();
|
|
18
16
|
});
|
|
19
17
|
test('getTrees() 1: Get all trees', async () => {
|
|
20
18
|
const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/getTrees/trees.json'), 'utf8'));
|
|
21
|
-
mock.onGet(
|
|
19
|
+
mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees?_queryFilter=true`).reply(200, response);
|
|
22
20
|
const trees = await TreeRaw.getTrees();
|
|
23
21
|
expect(trees).toBeTruthy();
|
|
24
|
-
expect(trees
|
|
22
|
+
expect(trees).toMatchSnapshot();
|
|
25
23
|
});
|
|
26
24
|
});
|
|
27
25
|
describe('TreeApi - getTree()', () => {
|
|
@@ -30,28 +28,21 @@ describe('TreeApi - getTree()', () => {
|
|
|
30
28
|
});
|
|
31
29
|
test('getTree() 1: Get existing tree', async () => {
|
|
32
30
|
const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/getTree/FrodoTest.json'), 'utf8'));
|
|
33
|
-
mock.onGet(
|
|
31
|
+
mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(200, response);
|
|
34
32
|
const tree = await TreeRaw.getTree('FrodoTest');
|
|
35
33
|
expect(tree).toBeTruthy();
|
|
36
|
-
expect(tree
|
|
34
|
+
expect(tree).toMatchSnapshot();
|
|
37
35
|
});
|
|
38
36
|
test('getTree() 2: Get non-existing tree', async () => {
|
|
39
|
-
mock.onGet(
|
|
37
|
+
mock.onGet(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist`).reply(404, {
|
|
40
38
|
code: 404,
|
|
41
39
|
reason: 'Not Found',
|
|
42
40
|
message: 'Not Found'
|
|
43
41
|
});
|
|
44
|
-
expect.assertions(2);
|
|
45
|
-
|
|
46
42
|
try {
|
|
47
43
|
await TreeRaw.getTree('DoesNotExist');
|
|
48
44
|
} catch (error) {
|
|
49
|
-
expect(error.response).
|
|
50
|
-
expect(error.response.data).toMatchObject({
|
|
51
|
-
code: 404,
|
|
52
|
-
reason: 'Not Found',
|
|
53
|
-
message: 'Not Found'
|
|
54
|
-
});
|
|
45
|
+
expect(error.response.data).toMatchSnapshot();
|
|
55
46
|
}
|
|
56
47
|
});
|
|
57
48
|
});
|
|
@@ -61,34 +52,29 @@ describe('TreeApi - putTree()', () => {
|
|
|
61
52
|
});
|
|
62
53
|
test('putTree() 1: Put valid tree', async () => {
|
|
63
54
|
const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/FrodoTest.json'), 'utf8'));
|
|
64
|
-
mock.onPut(
|
|
55
|
+
mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(201, response);
|
|
65
56
|
const tree = await TreeRaw.putTree('FrodoTest', response);
|
|
66
57
|
expect(tree).toBeTruthy();
|
|
67
|
-
expect(tree
|
|
58
|
+
expect(tree).toMatchSnapshot();
|
|
68
59
|
});
|
|
69
60
|
test('putTree() 2: Put invalid tree [trailing data]', async () => {
|
|
70
61
|
const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_trailing-data.txt'), 'utf8');
|
|
71
|
-
mock.onPut(
|
|
62
|
+
mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
|
|
72
63
|
code: 400,
|
|
73
64
|
reason: 'Bad Request',
|
|
74
65
|
message: 'The request could not be processed because there is trailing data after the JSON content'
|
|
75
66
|
});
|
|
76
67
|
expect.assertions(2);
|
|
77
|
-
|
|
78
68
|
try {
|
|
79
69
|
await TreeRaw.putTree('Invalid', request);
|
|
80
70
|
} catch (error) {
|
|
81
71
|
expect(error.response).toBeTruthy();
|
|
82
|
-
expect(error.response.data).
|
|
83
|
-
code: 400,
|
|
84
|
-
reason: 'Bad Request',
|
|
85
|
-
message: 'The request could not be processed because there is trailing data after the JSON content'
|
|
86
|
-
});
|
|
72
|
+
expect(error.response.data).toMatchSnapshot();
|
|
87
73
|
}
|
|
88
74
|
});
|
|
89
75
|
test('putTree() 3: Put invalid tree [invalid attribute]', async () => {
|
|
90
76
|
const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_invalid-attribute.json'), 'utf8');
|
|
91
|
-
mock.onPut(
|
|
77
|
+
mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
|
|
92
78
|
code: 400,
|
|
93
79
|
reason: 'Bad Request',
|
|
94
80
|
message: 'Invalid attribute specified.',
|
|
@@ -97,59 +83,41 @@ describe('TreeApi - putTree()', () => {
|
|
|
97
83
|
}
|
|
98
84
|
});
|
|
99
85
|
expect.assertions(2);
|
|
100
|
-
|
|
101
86
|
try {
|
|
102
87
|
await TreeRaw.putTree('Invalid', request);
|
|
103
88
|
} catch (error) {
|
|
104
89
|
expect(error.response).toBeTruthy();
|
|
105
|
-
expect(error.response.data).
|
|
106
|
-
code: 400,
|
|
107
|
-
reason: 'Bad Request',
|
|
108
|
-
message: 'Invalid attribute specified.',
|
|
109
|
-
detail: {
|
|
110
|
-
validAttributes: ['description', 'enabled', 'entryNodeId', 'identityResource', 'nodes', 'staticNodes', 'uiConfig']
|
|
111
|
-
}
|
|
112
|
-
});
|
|
90
|
+
expect(error.response.data).toMatchSnapshot();
|
|
113
91
|
}
|
|
114
92
|
});
|
|
115
93
|
test('putTree() 4: Put invalid tree [no entry node]', async () => {
|
|
116
94
|
const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_no-entry-node.json'), 'utf8');
|
|
117
|
-
mock.onPut(
|
|
95
|
+
mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
|
|
118
96
|
code: 400,
|
|
119
97
|
reason: 'Bad Request',
|
|
120
98
|
message: 'Node with ID entryNodeId must exist in the tree.'
|
|
121
99
|
});
|
|
122
100
|
expect.assertions(2);
|
|
123
|
-
|
|
124
101
|
try {
|
|
125
102
|
await TreeRaw.putTree('Invalid', request);
|
|
126
103
|
} catch (error) {
|
|
127
104
|
expect(error.response).toBeTruthy();
|
|
128
|
-
expect(error.response.data).
|
|
129
|
-
code: 400,
|
|
130
|
-
reason: 'Bad Request',
|
|
131
|
-
message: 'Node with ID entryNodeId must exist in the tree.'
|
|
132
|
-
});
|
|
105
|
+
expect(error.response.data).toMatchSnapshot();
|
|
133
106
|
}
|
|
134
107
|
});
|
|
135
108
|
test('putTree() 5: Put invalid tree [invalid nodes]', async () => {
|
|
136
109
|
const request = fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/putTree/Invalid_invalid-nodes.json'), 'utf8');
|
|
137
|
-
mock.onPut(
|
|
110
|
+
mock.onPut(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/Invalid`).reply(400, {
|
|
138
111
|
code: 400,
|
|
139
112
|
reason: 'Bad Request',
|
|
140
113
|
message: 'Node with ID entryNodeId must exist in the tree.'
|
|
141
114
|
});
|
|
142
115
|
expect.assertions(2);
|
|
143
|
-
|
|
144
116
|
try {
|
|
145
117
|
await TreeRaw.putTree('Invalid', request);
|
|
146
118
|
} catch (error) {
|
|
147
119
|
expect(error.response).toBeTruthy();
|
|
148
|
-
expect(error.response.data).
|
|
149
|
-
code: 400,
|
|
150
|
-
reason: 'Bad Request',
|
|
151
|
-
message: 'Node with ID entryNodeId must exist in the tree.'
|
|
152
|
-
});
|
|
120
|
+
expect(error.response.data).toMatchSnapshot();
|
|
153
121
|
}
|
|
154
122
|
});
|
|
155
123
|
});
|
|
@@ -159,28 +127,23 @@ describe('TreeApi - deleteTree()', () => {
|
|
|
159
127
|
});
|
|
160
128
|
test('deleteTree() 1: Delete existing tree', async () => {
|
|
161
129
|
const response = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../test/mocks/TreeApi/deleteTree/FrodoTest.json'), 'utf8'));
|
|
162
|
-
mock.onDelete(
|
|
130
|
+
mock.onDelete(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/FrodoTest`).reply(200, response);
|
|
163
131
|
const tree = await TreeRaw.deleteTree('FrodoTest');
|
|
164
132
|
expect(tree).toBeTruthy();
|
|
165
|
-
expect(tree
|
|
133
|
+
expect(tree).toMatchSnapshot();
|
|
166
134
|
});
|
|
167
135
|
test('deleteTree() 2: Delete non-existing tree', async () => {
|
|
168
|
-
mock.onDelete(
|
|
136
|
+
mock.onDelete(`${state.getHost()}/json/realms/root/realms/alpha/realm-config/authentication/authenticationtrees/trees/DoesNotExist`).reply(404, {
|
|
169
137
|
code: 404,
|
|
170
138
|
reason: 'Not Found',
|
|
171
139
|
message: 'Not Found'
|
|
172
140
|
});
|
|
173
141
|
expect.assertions(2);
|
|
174
|
-
|
|
175
142
|
try {
|
|
176
143
|
await TreeRaw.deleteTree('DoesNotExist');
|
|
177
144
|
} catch (error) {
|
|
178
145
|
expect(error.response).toBeTruthy();
|
|
179
|
-
expect(error.response.data).
|
|
180
|
-
code: 404,
|
|
181
|
-
reason: 'Not Found',
|
|
182
|
-
message: 'Not Found'
|
|
183
|
-
});
|
|
146
|
+
expect(error.response.data).toMatchSnapshot();
|
|
184
147
|
}
|
|
185
148
|
});
|
|
186
149
|
});
|
package/esm/api/VariablesApi.mjs
CHANGED
|
@@ -2,12 +2,11 @@ import util from 'util';
|
|
|
2
2
|
import { encode } from './utils/Base64';
|
|
3
3
|
import { getTenantURL, getCurrentRealmPath } from './utils/ApiUtils';
|
|
4
4
|
import { generateESVApi } from './BaseApi';
|
|
5
|
-
import
|
|
5
|
+
import * as state from '../shared/State';
|
|
6
6
|
const variablesListURLTemplate = '%s/environment/variables';
|
|
7
7
|
const variableURLTemplate = '%s/environment/variables/%s';
|
|
8
8
|
const variableSetDescriptionURLTemplate = `${variableURLTemplate}?_action=setDescription`;
|
|
9
9
|
const apiVersion = 'protocol=1.0,resource=1.0';
|
|
10
|
-
|
|
11
10
|
const getApiConfig = () => {
|
|
12
11
|
const configPath = getCurrentRealmPath();
|
|
13
12
|
return {
|
|
@@ -15,14 +14,13 @@ const getApiConfig = () => {
|
|
|
15
14
|
apiVersion
|
|
16
15
|
};
|
|
17
16
|
};
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* Get all variables
|
|
20
20
|
* @returns {Promise<unknown[]>} a promise that resolves to an array of variable objects
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
22
|
export async function getVariables() {
|
|
25
|
-
const urlString = util.format(variablesListURLTemplate, getTenantURL(
|
|
23
|
+
const urlString = util.format(variablesListURLTemplate, getTenantURL(state.getHost()));
|
|
26
24
|
const {
|
|
27
25
|
data
|
|
28
26
|
} = await generateESVApi(getApiConfig()).get(urlString, {
|
|
@@ -30,14 +28,14 @@ export async function getVariables() {
|
|
|
30
28
|
});
|
|
31
29
|
return data;
|
|
32
30
|
}
|
|
31
|
+
|
|
33
32
|
/**
|
|
34
33
|
* Get variable by id/name
|
|
35
34
|
* @param {string} variableId variable id/name
|
|
36
35
|
* @returns {Promise<unknown>} a promise that resolves to a variable object
|
|
37
36
|
*/
|
|
38
|
-
|
|
39
37
|
export async function getVariable(variableId) {
|
|
40
|
-
const urlString = util.format(variableURLTemplate, getTenantURL(
|
|
38
|
+
const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
|
|
41
39
|
const {
|
|
42
40
|
data
|
|
43
41
|
} = await generateESVApi(getApiConfig()).get(urlString, {
|
|
@@ -45,6 +43,7 @@ export async function getVariable(variableId) {
|
|
|
45
43
|
});
|
|
46
44
|
return data;
|
|
47
45
|
}
|
|
46
|
+
|
|
48
47
|
/**
|
|
49
48
|
* Put variable by id/name
|
|
50
49
|
* @param {string} variableId variable id/name
|
|
@@ -52,12 +51,11 @@ export async function getVariable(variableId) {
|
|
|
52
51
|
* @param {string} description variable description
|
|
53
52
|
* @returns {Promise<unknown>} a promise that resolves to a variable object
|
|
54
53
|
*/
|
|
55
|
-
|
|
56
54
|
export async function putVariable(variableId, value, description) {
|
|
57
55
|
const variableData = {};
|
|
58
56
|
if (value) variableData['valueBase64'] = encode(value);
|
|
59
57
|
if (description) variableData['description'] = description;
|
|
60
|
-
const urlString = util.format(variableURLTemplate, getTenantURL(
|
|
58
|
+
const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
|
|
61
59
|
const {
|
|
62
60
|
data
|
|
63
61
|
} = await generateESVApi(getApiConfig()).put(urlString, variableData, {
|
|
@@ -65,15 +63,15 @@ export async function putVariable(variableId, value, description) {
|
|
|
65
63
|
});
|
|
66
64
|
return data;
|
|
67
65
|
}
|
|
66
|
+
|
|
68
67
|
/**
|
|
69
68
|
* Set variable description
|
|
70
69
|
* @param {string} variableId variable id/name
|
|
71
70
|
* @param {string} description variable description
|
|
72
71
|
* @returns {Promise<unknown>} a promise that resolves to a status object
|
|
73
72
|
*/
|
|
74
|
-
|
|
75
73
|
export async function setVariableDescription(variableId, description) {
|
|
76
|
-
const urlString = util.format(variableSetDescriptionURLTemplate, getTenantURL(
|
|
74
|
+
const urlString = util.format(variableSetDescriptionURLTemplate, getTenantURL(state.getHost()), variableId);
|
|
77
75
|
const {
|
|
78
76
|
data
|
|
79
77
|
} = await generateESVApi(getApiConfig()).post(urlString, {
|
|
@@ -83,14 +81,14 @@ export async function setVariableDescription(variableId, description) {
|
|
|
83
81
|
});
|
|
84
82
|
return data;
|
|
85
83
|
}
|
|
84
|
+
|
|
86
85
|
/**
|
|
87
86
|
* Delete variable by id/name
|
|
88
87
|
* @param {string} variableId variable id/name
|
|
89
88
|
* @returns {Promise<unknown>} a promise that resolves to a variable object
|
|
90
89
|
*/
|
|
91
|
-
|
|
92
90
|
export async function deleteVariable(variableId) {
|
|
93
|
-
const urlString = util.format(variableURLTemplate, getTenantURL(
|
|
91
|
+
const urlString = util.format(variableURLTemplate, getTenantURL(state.getHost()), variableId);
|
|
94
92
|
const {
|
|
95
93
|
data
|
|
96
94
|
} = await generateESVApi(getApiConfig()).delete(urlString, {
|
|
@@ -1,229 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { VariablesRaw } from '../index';
|
|
2
|
+
import autoSetupPolly from '../utils/AutoSetupPolly';
|
|
3
|
+
const pollyContext = autoSetupPolly();
|
|
4
|
+
describe('VariablesApi', () => {
|
|
5
|
+
describe('VariablesApi - getVariables()', () => {
|
|
6
|
+
test('getVariables() 0: Method is implemented', async () => {
|
|
7
|
+
expect(VariablesRaw.getVariables).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
test('getVariables() 1: Get all variables - success', async () => {
|
|
10
|
+
const response = await VariablesRaw.getVariables();
|
|
11
|
+
expect(response).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
test('getVariables() 2: Get all variables - error', async () => {
|
|
14
|
+
try {
|
|
15
|
+
await VariablesRaw.getVariables();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
expect(error.response.data).toMatchSnapshot();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
12
20
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
lastChangeDate: '2021-12-09T16:48:18.482Z',
|
|
30
|
-
lastChangedBy: 'forgerock-automation',
|
|
31
|
-
loaded: true,
|
|
32
|
-
valueBase64: 'RnJkcC0yMDEw'
|
|
33
|
-
}, {
|
|
34
|
-
_id: 'esv-twilio-account-sid',
|
|
35
|
-
description: 'Twilio account SID. Get your own at: https://twilio.com',
|
|
36
|
-
expressionType: '',
|
|
37
|
-
lastChangeDate: '2022-08-12T21:26:32.688Z',
|
|
38
|
-
lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
|
|
39
|
-
loaded: true,
|
|
40
|
-
valueBase64: 'QUM3NTA0MTVlMzE2M2EyZTU3YjdhZWVhN2VlZDgyZDk0NA=='
|
|
41
|
-
}, {
|
|
42
|
-
_id: 'esv-ipv4-cidr-access-rules',
|
|
43
|
-
description: 'IPv4 CIDR access rules: { "allow": [ "address/mask" ] }',
|
|
44
|
-
expressionType: '',
|
|
45
|
-
lastChangeDate: '2022-08-25T20:16:54.243Z',
|
|
46
|
-
lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
|
|
47
|
-
loaded: true,
|
|
48
|
-
valueBase64: 'eyAiYWxsb3ciOiBbICIxNDUuMTE4LjAuMC8xNiIsICIxMzIuMzUuMC4wLzE2IiwgIjEwMS4yMjYuMC4wLzE2IiwgIjk5LjcyLjI4LjE4Mi8zMiIgXSB9'
|
|
49
|
-
}, {
|
|
50
|
-
_id: 'esv-volkerstestvariable1',
|
|
51
|
-
description: "Volker's Updated Test Variable Description",
|
|
52
|
-
expressionType: '',
|
|
53
|
-
lastChangeDate: '2022-04-10T20:55:39.746Z',
|
|
54
|
-
lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
|
|
55
|
-
loaded: true,
|
|
56
|
-
valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
|
|
57
|
-
}],
|
|
58
|
-
resultCount: 5,
|
|
59
|
-
totalPagedResults: -1,
|
|
60
|
-
totalPagedResultsPolicy: 'NONE'
|
|
61
|
-
};
|
|
62
|
-
mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables').reply(200, mockResponse);
|
|
63
|
-
const response = await VariablesRaw.getVariables();
|
|
64
|
-
expect(response).toBeTruthy();
|
|
65
|
-
expect(response).toMatchObject(mockResponse);
|
|
21
|
+
describe('VariablesApi - getVariable()', () => {
|
|
22
|
+
test('getVariable() 0: Method is implemented', async () => {
|
|
23
|
+
expect(VariablesRaw.getVariable).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
test('getVariable() 1: Get existing variable: esv-volkerstestvariable1', async () => {
|
|
26
|
+
const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');
|
|
27
|
+
expect(response).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {
|
|
30
|
+
try {
|
|
31
|
+
await VariablesRaw.getVariable('esv-does-not-exist');
|
|
32
|
+
} catch (error) {
|
|
33
|
+
// expect(error.response.status).toBe(404);
|
|
34
|
+
expect(error.response.data).toMatchSnapshot();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
66
37
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
83
|
-
}
|
|
38
|
+
describe('VariablesApi - putVariable()', () => {
|
|
39
|
+
test('putVariable() 0: Method is implemented', async () => {
|
|
40
|
+
expect(VariablesRaw.putVariable).toBeDefined();
|
|
41
|
+
});
|
|
42
|
+
test('putVariable() 1: Create variable: esv-volkerstestvariable2 - success', async () => {
|
|
43
|
+
const response = await VariablesRaw.putVariable('esv-volkerstestvariable2', "Volker's Test Variable Value", "Volker's Test Variable Description");
|
|
44
|
+
expect(response).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
test('putVariable() 2: Create variable: esv-volkerstestvariable2 - error', async () => {
|
|
47
|
+
try {
|
|
48
|
+
await VariablesRaw.putVariable('esv-volkerstestvariable2', "Volker's Test Variable Value", "Volker's Test Variable Description");
|
|
49
|
+
} catch (error) {
|
|
50
|
+
expect(error.response.data).toMatchSnapshot();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
84
53
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
|
|
101
|
-
const response = await VariablesRaw.getVariable('esv-volkerstestvariable1');
|
|
102
|
-
expect(response).toBeTruthy();
|
|
103
|
-
expect(response).toMatchObject(mockResponse);
|
|
104
|
-
});
|
|
105
|
-
test('getVariable() 2: Get non-existing variable: esv-does-not-exist', async () => {
|
|
106
|
-
const mockResponse = {
|
|
107
|
-
code: 404,
|
|
108
|
-
message: 'The variable does not exist'
|
|
109
|
-
};
|
|
110
|
-
mock.onGet('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-does-not-exist').reply(404, mockResponse);
|
|
111
|
-
expect.assertions(4);
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
await VariablesRaw.getVariable('esv-does-not-exist');
|
|
115
|
-
} catch (error) {
|
|
116
|
-
// console.dir(error);
|
|
117
|
-
expect(error).toBeTruthy();
|
|
118
|
-
expect(error.response.status).toBe(404);
|
|
119
|
-
expect(error.response.data.code).toBe(404);
|
|
120
|
-
expect(error.response.data.message).toBe('The variable does not exist');
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
describe('VariablesApi - putVariable()', () => {
|
|
125
|
-
test('putVariable() 0: Method is implemented', async () => {
|
|
126
|
-
expect(VariablesRaw.putVariable).toBeDefined();
|
|
127
|
-
});
|
|
128
|
-
test('putVariable() 1: Create variable: esv-volkerstestvariable1 - success', async () => {
|
|
129
|
-
const mockResponse = {
|
|
130
|
-
_id: 'esv-volkerstestvariable1',
|
|
131
|
-
description: "Volker's Updated Test Variable Description",
|
|
132
|
-
expressionType: '',
|
|
133
|
-
lastChangeDate: '2022-04-10T20:55:39.746Z',
|
|
134
|
-
lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
|
|
135
|
-
loaded: true,
|
|
136
|
-
valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
|
|
137
|
-
};
|
|
138
|
-
mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
|
|
139
|
-
const response = await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
|
|
140
|
-
expect(response).toBeTruthy();
|
|
141
|
-
expect(response).toMatchObject(mockResponse);
|
|
142
|
-
});
|
|
143
|
-
test('putVariable() 2: Create variable: esv-volkerstestvariable1 - error', async () => {
|
|
144
|
-
const mockResponse = {
|
|
145
|
-
code: 500,
|
|
146
|
-
message: 'Server Error'
|
|
147
|
-
};
|
|
148
|
-
mock.onPut('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(500, mockResponse);
|
|
149
|
-
expect.assertions(4);
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
await VariablesRaw.putVariable('esv-volkerstestvariable1', "Volker's Test Variable Value", "Volker's Test Variable Description");
|
|
153
|
-
} catch (error) {
|
|
154
|
-
// console.dir(error);
|
|
155
|
-
expect(error).toBeTruthy();
|
|
156
|
-
expect(error.response.status).toBe(500);
|
|
157
|
-
expect(error.response.data.code).toBe(500);
|
|
158
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('VariablesApi - setVariableDescription()', () => {
|
|
163
|
-
test('setVariableDescription() 0: Method is implemented', async () => {
|
|
164
|
-
expect(VariablesRaw.setVariableDescription).toBeDefined();
|
|
165
|
-
});
|
|
166
|
-
test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable1 - success', async () => {
|
|
167
|
-
const mockResponse = '';
|
|
168
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(200, mockResponse);
|
|
169
|
-
const response = await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
|
|
170
|
-
expect(response).toBe('');
|
|
171
|
-
});
|
|
172
|
-
test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable1 - error', async () => {
|
|
173
|
-
const mockResponse = {
|
|
174
|
-
code: 500,
|
|
175
|
-
message: 'Server Error'
|
|
176
|
-
};
|
|
177
|
-
mock.onPost('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1?_action=setDescription').reply(500, mockResponse);
|
|
178
|
-
expect.assertions(4);
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
await VariablesRaw.setVariableDescription('esv-volkerstestvariable1', "Volker's Updated Test Secret Description");
|
|
182
|
-
} catch (error) {
|
|
183
|
-
// console.dir(error);
|
|
184
|
-
expect(error).toBeTruthy();
|
|
185
|
-
expect(error.response.status).toBe(500);
|
|
186
|
-
expect(error.response.data.code).toBe(500);
|
|
187
|
-
expect(error.response.data.message).toBe('Server Error');
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
describe('VariablesApi - deleteVariable()', () => {
|
|
192
|
-
test('deleteVariable() 0: Method is implemented', async () => {
|
|
193
|
-
expect(VariablesRaw.deleteVariable).toBeDefined();
|
|
194
|
-
});
|
|
195
|
-
test('deleteVariable() 1: Delete variable: esv-volkerstestvariable1 - success', async () => {
|
|
196
|
-
const mockResponse = {
|
|
197
|
-
_id: 'esv-volkerstestvariable1',
|
|
198
|
-
description: "Volker's Updated Test Variable Description",
|
|
199
|
-
expressionType: '',
|
|
200
|
-
lastChangeDate: '2022-04-10T20:55:39.746Z',
|
|
201
|
-
lastChangedBy: 'c5f3cf35-4cc1-42f9-80b3-59e1ca842510',
|
|
202
|
-
loaded: true,
|
|
203
|
-
valueBase64: 'Vm9sa2VyJ3MgVGVzdCBWYXJpYWJsZSBWYWx1ZQo='
|
|
204
|
-
};
|
|
205
|
-
mock.onDelete('https://openam-frodo-dev.forgeblocks.com/environment/variables/esv-volkerstestvariable1').reply(200, mockResponse);
|
|
206
|
-
const response = await VariablesRaw.deleteVariable('esv-volkerstestvariable1');
|
|
207
|
-
expect(response).toBeTruthy();
|
|
208
|
-
expect(response).toMatchObject(mockResponse);
|
|
54
|
+
describe('VariablesApi - setVariableDescription()', () => {
|
|
55
|
+
test('setVariableDescription() 0: Method is implemented', async () => {
|
|
56
|
+
expect(VariablesRaw.setVariableDescription).toBeDefined();
|
|
57
|
+
});
|
|
58
|
+
test('setVariableDescription() 1: Set variable description: esv-volkerstestvariable2 - success', async () => {
|
|
59
|
+
const response = await VariablesRaw.setVariableDescription('esv-volkerstestvariable2', "Volker's Updated Test Secret Description");
|
|
60
|
+
expect(response).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
test('setVariableDescription() 2: Set variable description: esv-volkerstestvariable3 - error', async () => {
|
|
63
|
+
try {
|
|
64
|
+
await VariablesRaw.setVariableDescription('esv-volkerstestvariable3', "Volker's Updated Test Secret Description");
|
|
65
|
+
} catch (error) {
|
|
66
|
+
expect(error.response.data).toMatchSnapshot();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
209
69
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
expect(error.response.data.message).toBe('Cannot delete a variable that has an existing config placeholder');
|
|
226
|
-
}
|
|
70
|
+
describe('VariablesApi - deleteVariable()', () => {
|
|
71
|
+
test('deleteVariable() 0: Method is implemented', async () => {
|
|
72
|
+
expect(VariablesRaw.deleteVariable).toBeDefined();
|
|
73
|
+
});
|
|
74
|
+
test('deleteVariable() 1: Delete variable: esv-volkerstestvariable2 - success', async () => {
|
|
75
|
+
const response = await VariablesRaw.deleteVariable('esv-volkerstestvariable2');
|
|
76
|
+
expect(response).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
test('deleteVariable() 2: Delete variable: esv-volkerstestvariable3 - error', async () => {
|
|
79
|
+
try {
|
|
80
|
+
await VariablesRaw.deleteVariable('esv-volkerstestvariable3');
|
|
81
|
+
} catch (error) {
|
|
82
|
+
expect(error.response.data).toMatchSnapshot();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
227
85
|
});
|
|
228
86
|
});
|
|
229
87
|
//# sourceMappingURL=VariablesApi.test.js.map
|