@rockcarver/frodo-cli 0.10.4 → 0.11.1-0
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/.github/README.md +44 -104
- package/.github/workflows/pipeline.yml +9 -1
- package/CHANGELOG.md +5 -1
- package/README.md +3 -3
- package/package.json +8 -8
- package/src/app.js +5 -4
- package/src/cli/_template/cmd-delete.js +9 -8
- package/src/cli/_template/cmd-describe.js +9 -8
- package/src/cli/_template/cmd-export.js +9 -8
- package/src/cli/_template/cmd-import.js +9 -8
- package/src/cli/_template/cmd-list.js +9 -8
- package/src/cli/_template/cmd-sub1-delete.js +9 -8
- package/src/cli/_template/cmd-sub1-describe.js +9 -8
- package/src/cli/_template/cmd-sub1-export.js +9 -8
- package/src/cli/_template/cmd-sub1-import.js +9 -8
- package/src/cli/_template/cmd-sub1-list.js +9 -8
- package/src/cli/_template/cmd-sub2-delete.js +9 -8
- package/src/cli/_template/cmd-sub2-describe.js +9 -8
- package/src/cli/_template/cmd-sub2-export.js +9 -8
- package/src/cli/_template/cmd-sub2-import.js +9 -8
- package/src/cli/_template/cmd-sub2-list.js +9 -8
- package/src/cli/admin/admin-add-autoid-static-user-mapping.js +12 -12
- package/src/cli/admin/admin-create-oauth2-client-with-admin-privileges.js +15 -18
- package/src/cli/admin/admin-get-access-token.js +12 -12
- package/src/cli/admin/admin-grant-oauth2-client-admin-privileges.js +13 -13
- package/src/cli/admin/admin-hide-generic-extension-attributes.js +13 -13
- package/src/cli/admin/admin-list-oauth2-clients-with-admin-privileges.js +13 -13
- package/src/cli/admin/admin-list-oauth2-clients-with-custom-privileges.js +14 -13
- package/src/cli/admin/admin-list-static-user-mappings.js +12 -12
- package/src/cli/admin/admin-remove-static-user-mapping.js +12 -12
- package/src/cli/admin/admin-repair-org-model.js +13 -13
- package/src/cli/admin/admin-revoke-oauth2-client-admin-privileges.js +13 -13
- package/src/cli/admin/admin-show-generic-extension-attributes.js +13 -13
- package/src/cli/app/app-delete.js +9 -8
- package/src/cli/app/app-describe.js +9 -8
- package/src/cli/app/app-export.js +15 -15
- package/src/cli/app/app-import.js +11 -11
- package/src/cli/app/app-list.js +11 -12
- package/src/cli/conn/conn-add.js +11 -11
- package/src/cli/conn/conn-delete.js +3 -1
- package/src/cli/conn/conn-describe.js +3 -1
- package/src/cli/conn/conn-list.js +3 -4
- package/src/cli/email/email-template-export.js +16 -16
- package/src/cli/email/email-template-import.js +16 -16
- package/src/cli/email/email-template-list.js +11 -11
- package/src/cli/esv/esv-apply.js +12 -12
- package/src/cli/esv/esv-secret-create.js +11 -11
- package/src/cli/esv/esv-secret-delete.js +13 -13
- package/src/cli/esv/esv-secret-describe.js +11 -11
- package/src/cli/esv/esv-secret-export.js +9 -8
- package/src/cli/esv/esv-secret-import.js +9 -8
- package/src/cli/esv/esv-secret-list.js +11 -11
- package/src/cli/esv/esv-secret-set.js +11 -11
- package/src/cli/esv/esv-secret-version-activate.js +12 -12
- package/src/cli/esv/esv-secret-version-create.js +11 -11
- package/src/cli/esv/esv-secret-version-deactivate.js +12 -12
- package/src/cli/esv/esv-secret-version-delete.js +13 -13
- package/src/cli/esv/esv-secret-version-list.js +11 -11
- package/src/cli/esv/esv-variable-create.js +11 -11
- package/src/cli/esv/esv-variable-delete.js +13 -16
- package/src/cli/esv/esv-variable-describe.js +11 -11
- package/src/cli/esv/esv-variable-export.js +9 -8
- package/src/cli/esv/esv-variable-import.js +9 -8
- package/src/cli/esv/esv-variable-list.js +11 -11
- package/src/cli/esv/esv-variable-set.js +13 -16
- package/src/cli/idm/idm-count.js +11 -11
- package/src/cli/idm/idm-export.js +16 -16
- package/src/cli/idm/idm-list.js +11 -11
- package/src/cli/idp/idp-export.js +15 -19
- package/src/cli/idp/idp-import.js +18 -18
- package/src/cli/idp/idp-list.js +12 -12
- package/src/cli/info/info.js +23 -19
- package/src/cli/journey/{journey-delete.e2e.test.js → journey-delete.e2e.test_.js} +0 -0
- package/src/cli/journey/journey-delete.js +14 -14
- package/src/cli/journey/journey-describe.js +26 -35
- package/src/cli/journey/journey-export.js +15 -18
- package/src/cli/journey/journey-import.js +17 -17
- package/src/cli/journey/{journey-list.e2e.test.js → journey-list.e2e.test_.js} +1 -0
- package/src/cli/journey/journey-list.js +12 -12
- package/src/cli/journey/journey-prune.js +12 -12
- package/src/cli/logging/logs-list.js +33 -28
- package/src/cli/logging/logs-tail.js +26 -22
- package/src/cli/realm/realm-add-custom-domain.js +13 -13
- package/src/cli/realm/realm-describe.js +14 -14
- package/src/cli/realm/realm-list.js +11 -11
- package/src/cli/realm/realm-remove-custom-domain.js +16 -13
- package/src/cli/saml/saml-cot-export.js +16 -16
- package/src/cli/saml/saml-cot-import.js +18 -18
- package/src/cli/saml/saml-cot-list.js +12 -12
- package/src/cli/saml/saml-describe.js +12 -12
- package/src/cli/saml/saml-export.js +16 -19
- package/src/cli/saml/saml-import.js +19 -18
- package/src/cli/saml/saml-list.js +12 -12
- package/src/cli/saml/saml-metadata-export.js +15 -19
- package/src/cli/script/script-delete.js +9 -8
- package/src/cli/script/script-describe.js +9 -8
- package/src/cli/script/script-export.js +18 -20
- package/src/cli/script/script-import.js +13 -12
- package/src/cli/script/script-list.js +12 -12
- package/src/cli/theme/{theme-delete.e2e.test.js → theme-delete.e2e.test_.js} +0 -0
- package/src/cli/theme/theme-delete.js +17 -21
- package/src/cli/theme/theme-export.js +19 -18
- package/src/cli/theme/theme-import.js +21 -20
- package/src/cli/theme/{theme-list.e2e.test.js → theme-list.e2e.test_.js} +0 -0
- package/src/cli/theme/theme-list.js +12 -12
- package/test/client_cli/en/conn-add.test.js +37 -0
- package/test/client_cli/en/conn-delete.test.js +37 -0
- package/test/client_cli/en/conn-list.test.js +37 -0
- package/test/client_cli/en/conn.test.js +65 -0
- package/test/client_cli/en/email-template-import.test.js +156 -0
- package/test/client_cli/en/email-template.test.js +79 -0
- package/test/client_cli/en/email-templates-export.test.js +208 -0
- package/test/client_cli/en/email-templates-list.test.js +139 -0
- package/test/client_cli/en/idm-count.test.js +131 -0
- package/test/client_cli/en/idm-export.test.js +149 -0
- package/test/client_cli/en/{idm_import.test_.js → idm-import.test_.js} +59 -61
- package/test/client_cli/en/idm-list.test.js +109 -0
- package/test/client_cli/en/idm.test.js +55 -84
- package/test/client_cli/en/info.test.js +85 -74
- package/test/client_cli/en/journey-describe.test.js +194 -0
- package/test/client_cli/en/journey-export.test.js +231 -0
- package/test/client_cli/en/journey-import.test.js +212 -0
- package/test/client_cli/en/journey-list.test.js +173 -0
- package/test/client_cli/en/{journey_prune.test.js → journey-prune.test.js} +102 -91
- package/test/client_cli/en/journey.test.js +76 -92
- package/test/client_cli/en/logs-list.test.js +81 -0
- package/test/client_cli/en/logs-tail.test.js +130 -0
- package/test/client_cli/en/logs.test.js +44 -58
- package/test/client_cli/en/root.test.js +61 -59
- package/test/client_cli/en/script-export.test.js +230 -0
- package/test/client_cli/en/script-import.test.js +176 -0
- package/test/client_cli/en/script-list.test.js +159 -0
- package/test/client_cli/en/script.test.js +52 -50
- package/test/client_cli/utils/utils.js +48 -17
- package/src/api/AuthenticateApi.js +0 -33
- package/src/api/BaseApi.js +0 -242
- package/src/api/CirclesOfTrustApi.js +0 -87
- package/src/api/EmailTemplateApi.js +0 -37
- package/src/api/IdmConfigApi.js +0 -88
- package/src/api/LogApi.js +0 -45
- package/src/api/ManagedObjectApi.js +0 -62
- package/src/api/OAuth2ClientApi.js +0 -69
- package/src/api/OAuth2OIDCApi.js +0 -73
- package/src/api/OAuth2ProviderApi.js +0 -32
- package/src/api/RealmApi.js +0 -99
- package/src/api/Saml2Api.js +0 -176
- package/src/api/ScriptApi.js +0 -84
- package/src/api/SecretsApi.js +0 -151
- package/src/api/ServerInfoApi.js +0 -41
- package/src/api/SocialIdentityProvidersApi.js +0 -114
- package/src/api/StartupApi.js +0 -45
- package/src/api/ThemeApi.js +0 -181
- package/src/api/TreeApi.js +0 -207
- package/src/api/VariablesApi.js +0 -104
- package/src/api/utils/ApiUtils.js +0 -77
- package/src/api/utils/Base64.js +0 -62
- package/src/ops/AdminOps.js +0 -901
- package/src/ops/AuthenticateOps.js +0 -342
- package/src/ops/CirclesOfTrustOps.js +0 -350
- package/src/ops/ConnectionProfileOps.js +0 -254
- package/src/ops/EmailTemplateOps.js +0 -326
- package/src/ops/IdmOps.js +0 -227
- package/src/ops/IdpOps.js +0 -342
- package/src/ops/JourneyOps.js +0 -2026
- package/src/ops/LogOps.js +0 -357
- package/src/ops/ManagedObjectOps.js +0 -34
- package/src/ops/OAuth2ClientOps.js +0 -151
- package/src/ops/OrganizationOps.js +0 -85
- package/src/ops/RealmOps.js +0 -139
- package/src/ops/SamlOps.js +0 -541
- package/src/ops/ScriptOps.js +0 -211
- package/src/ops/SecretsOps.js +0 -288
- package/src/ops/StartupOps.js +0 -114
- package/src/ops/ThemeOps.js +0 -379
- package/src/ops/VariablesOps.js +0 -185
- package/src/ops/templates/OAuth2ClientTemplate.json +0 -270
- package/src/ops/templates/OrgModelUserAttributesTemplate.json +0 -149
- package/src/ops/templates/cloud/GenericExtensionAttributesTemplate.json +0 -392
- package/src/ops/templates/cloud/managed.json +0 -4119
- package/src/ops/utils/Console.js +0 -434
- package/src/ops/utils/DataProtection.js +0 -92
- package/src/ops/utils/ExportImportUtils.js +0 -146
- package/src/ops/utils/OpsUtils.js +0 -76
- package/src/ops/utils/Wordwrap.js +0 -11
- package/src/storage/SessionStorage.js +0 -45
- package/test/client_cli/en/connections.test.js +0 -62
- package/test/client_cli/en/connections_add.test.js +0 -34
- package/test/client_cli/en/connections_delete.test.js +0 -34
- package/test/client_cli/en/connections_list.test.js +0 -34
- package/test/client_cli/en/email_templates.test.js +0 -77
- package/test/client_cli/en/email_templates_export.test.js +0 -196
- package/test/client_cli/en/email_templates_import.test.js +0 -145
- package/test/client_cli/en/email_templates_list.test.js +0 -130
- package/test/client_cli/en/idm_count.test.js +0 -121
- package/test/client_cli/en/idm_export.test.js +0 -136
- package/test/client_cli/en/idm_exportAll.test.js +0 -156
- package/test/client_cli/en/idm_exportAllRaw.test.js +0 -120
- package/test/client_cli/en/idm_importAll.test_.js +0 -103
- package/test/client_cli/en/idm_list.test.js +0 -103
- package/test/client_cli/en/journey_describe.test.js +0 -196
- package/test/client_cli/en/journey_export.test.js +0 -213
- package/test/client_cli/en/journey_import.test.js +0 -195
- package/test/client_cli/en/journey_importAll.test.js +0 -180
- package/test/client_cli/en/journey_list.test.js +0 -162
- package/test/client_cli/en/logs_list.test.js +0 -83
- package/test/client_cli/en/logs_tail.test.js +0 -118
- package/test/client_cli/en/script_export.test.js +0 -213
- package/test/client_cli/en/script_import.test.js +0 -163
- package/test/client_cli/en/script_list.test.js +0 -148
- package/test/e2e/setup.js +0 -98
- package/test/global/setup.js +0 -65
- package/test/lib_api/unit_tests/ApiUtils.test.js +0 -186
- package/test/lib_api/unit_tests/Base64URL.test.js +0 -22
- package/test/lib_api/unit_tests/DataProtection.test.js +0 -25
- package/test/lib_api/unit_tests/ExportImportUtils.test.js +0 -121
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import {
|
|
4
|
+
crudeMultilineTakeUntil,
|
|
5
|
+
collapseWhitespace,
|
|
6
|
+
node14Compatibility,
|
|
7
|
+
} from '../utils/utils.js';
|
|
8
|
+
|
|
9
|
+
node14Compatibility();
|
|
10
|
+
|
|
11
|
+
const exec = promisify(cp.exec);
|
|
12
|
+
const CMD = 'frodo journey export --help';
|
|
13
|
+
const { stdout } = await exec(CMD);
|
|
14
|
+
|
|
15
|
+
test("CLI help interface for 'journey export' Usage should be expected english", async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const expected = `
|
|
18
|
+
Usage: frodo journey export [options] <host> [realm] [user] [password]
|
|
19
|
+
`.trim();
|
|
20
|
+
// Act
|
|
21
|
+
const testLine = stdout
|
|
22
|
+
.split(/\n/)
|
|
23
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
24
|
+
.trim();
|
|
25
|
+
// Assert
|
|
26
|
+
expect(testLine).toBe(expected);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("CLI help interface 'journey export' description at line 2 should be expected english", async () => {
|
|
30
|
+
// Arrange
|
|
31
|
+
const expected = `
|
|
32
|
+
Export journeys/trees.
|
|
33
|
+
`.trim();
|
|
34
|
+
// Act
|
|
35
|
+
const testLine = stdout
|
|
36
|
+
.split(/\n/)
|
|
37
|
+
.map((line) => line.trim())
|
|
38
|
+
.at(2);
|
|
39
|
+
// Assert
|
|
40
|
+
expect(testLine).toBe(expected);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("CLI help interface 'export argument host' description should be expected english multiline", async () => {
|
|
44
|
+
// Arrange
|
|
45
|
+
const expected = collapseWhitespace(`
|
|
46
|
+
host Access Management base URL, e.g.:
|
|
47
|
+
https://cdk.iam.example.com/am. To use a connection
|
|
48
|
+
profile, just specify a unique substring.
|
|
49
|
+
`);
|
|
50
|
+
// Act
|
|
51
|
+
const testLine = collapseWhitespace(
|
|
52
|
+
crudeMultilineTakeUntil(
|
|
53
|
+
stdout,
|
|
54
|
+
' host ',
|
|
55
|
+
' realm '
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Assert
|
|
60
|
+
expect(testLine).toBe(expected);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("CLI help interface 'export argument realm' description should be expected english multiline", async () => {
|
|
64
|
+
// Arrange
|
|
65
|
+
const expected = collapseWhitespace(`
|
|
66
|
+
realm Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise. (default: "alpha" for Identity Cloud tenants, "/" otherwise.)
|
|
67
|
+
`);
|
|
68
|
+
// Act
|
|
69
|
+
const testLine = collapseWhitespace(
|
|
70
|
+
crudeMultilineTakeUntil(
|
|
71
|
+
stdout,
|
|
72
|
+
' realm ',
|
|
73
|
+
' user '
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Assert
|
|
78
|
+
expect(testLine).toBe(expected);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("CLI help interface 'export argument user' description should be expected english multiline", async () => {
|
|
82
|
+
// Arrange
|
|
83
|
+
const expected = collapseWhitespace(`
|
|
84
|
+
user Username to login with. Must be an admin user with appropriate
|
|
85
|
+
rights to manage authentication journeys/trees.
|
|
86
|
+
`);
|
|
87
|
+
// Act
|
|
88
|
+
const testLine = collapseWhitespace(
|
|
89
|
+
crudeMultilineTakeUntil(
|
|
90
|
+
stdout,
|
|
91
|
+
' user ',
|
|
92
|
+
' password '
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Assert
|
|
97
|
+
expect(testLine).toBe(expected);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("CLI help interface 'export argument password' description should be expected english", async () => {
|
|
101
|
+
// Arrange
|
|
102
|
+
const expectedDescription = `
|
|
103
|
+
password Password.
|
|
104
|
+
`.trim();
|
|
105
|
+
// Act
|
|
106
|
+
const testLine = stdout
|
|
107
|
+
.split(/\n/)
|
|
108
|
+
.find((line) => line.trim().startsWith('password'))
|
|
109
|
+
.trim();
|
|
110
|
+
// Assert
|
|
111
|
+
expect(testLine).toBe(expectedDescription);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("CLI help interface 'export option -m, --type <type>' description should be expected english multiline", async () => {
|
|
115
|
+
// Arrange
|
|
116
|
+
const expected = collapseWhitespace(`
|
|
117
|
+
-m, --type <type> Override auto-detected deployment type. Valid values for
|
|
118
|
+
type:
|
|
119
|
+
classic: A classic Access Management-only deployment
|
|
120
|
+
with custom layout and configuration.
|
|
121
|
+
cloud: A ForgeRock Identity Cloud environment.
|
|
122
|
+
forgeops: A ForgeOps CDK or CDM deployment.
|
|
123
|
+
The detected or provided deployment type controls certain
|
|
124
|
+
behavior like obtaining an Identity Management admin
|
|
125
|
+
token or not and whether to export/import referenced
|
|
126
|
+
email templates or how to walk through the tenant admin
|
|
127
|
+
login flow of Identity Cloud and handle MFA (choices:
|
|
128
|
+
"classic", "cloud", "forgeops")
|
|
129
|
+
`);
|
|
130
|
+
// Act
|
|
131
|
+
const testLine = collapseWhitespace(
|
|
132
|
+
crudeMultilineTakeUntil(
|
|
133
|
+
stdout,
|
|
134
|
+
' -m, --type <type> ',
|
|
135
|
+
' -k, --insecure '
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Assert
|
|
140
|
+
expect(testLine).toBe(expected);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test("CLI help interface 'export option -k, --insecure' description should be expected english multiline", async () => {
|
|
144
|
+
// Arrange
|
|
145
|
+
const expected = collapseWhitespace(`
|
|
146
|
+
-k, --insecure Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https
|
|
147
|
+
(HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability. (default:
|
|
148
|
+
Don't allow insecure connections)
|
|
149
|
+
`);
|
|
150
|
+
// Act
|
|
151
|
+
const testLine = collapseWhitespace(
|
|
152
|
+
crudeMultilineTakeUntil(
|
|
153
|
+
stdout,
|
|
154
|
+
' -k, --insecure ',
|
|
155
|
+
' -i, --journey-id <journey> '
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
// Assert
|
|
160
|
+
expect(testLine).toBe(expected);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("CLI help interface 'export option -t, --tree <tree>' description should be expected english multiline", async () => {
|
|
164
|
+
// Arrange
|
|
165
|
+
const expected = collapseWhitespace(`
|
|
166
|
+
-i, --journey-id <journey> Name of a journey/tree. If specified, -a and -A are ignored.
|
|
167
|
+
`);
|
|
168
|
+
// Act
|
|
169
|
+
const testLine = collapseWhitespace(
|
|
170
|
+
crudeMultilineTakeUntil(
|
|
171
|
+
stdout,
|
|
172
|
+
' -i, --journey-id <journey> ',
|
|
173
|
+
' -f, --file <file> '
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// Assert
|
|
178
|
+
expect(testLine).toBe(expected);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("CLI help interface 'export option -f, --file <file>' description should be expected english", async () => {
|
|
182
|
+
// Arrange
|
|
183
|
+
const expected = collapseWhitespace(`
|
|
184
|
+
-f, --file <file> Name of the file to write the exported journey(s) to. Ignored with -A.
|
|
185
|
+
`);
|
|
186
|
+
// Act
|
|
187
|
+
const testLine = collapseWhitespace(
|
|
188
|
+
crudeMultilineTakeUntil(
|
|
189
|
+
stdout,
|
|
190
|
+
' -f, --file <file> ',
|
|
191
|
+
' -a, --all '
|
|
192
|
+
)
|
|
193
|
+
);
|
|
194
|
+
// Assert
|
|
195
|
+
expect(testLine).toBe(expected);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test("CLI help interface 'export option -a, --all' description should be expected english", async () => {
|
|
199
|
+
// Arrange
|
|
200
|
+
const expected = collapseWhitespace(`
|
|
201
|
+
-a, --all Export all the journeys/trees in a realm. Ignored with -i.
|
|
202
|
+
`);
|
|
203
|
+
// Act
|
|
204
|
+
const testLine = collapseWhitespace(
|
|
205
|
+
crudeMultilineTakeUntil(
|
|
206
|
+
stdout,
|
|
207
|
+
' -a, --all ',
|
|
208
|
+
' -A, --all-separate '
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
// Assert
|
|
212
|
+
expect(testLine).toBe(expected);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test("CLI help interface 'export option -A, --allSeparate' description should be expected english", async () => {
|
|
216
|
+
// Arrange
|
|
217
|
+
const expected = collapseWhitespace(`
|
|
218
|
+
-A, --all-separate Export all the journeys/trees in a realm as separate files <journey/tree name>.json. Ignored with -i or
|
|
219
|
+
-a.
|
|
220
|
+
`);
|
|
221
|
+
// Act
|
|
222
|
+
const testLine = collapseWhitespace(
|
|
223
|
+
crudeMultilineTakeUntil(
|
|
224
|
+
stdout,
|
|
225
|
+
' -A, --all-separate ',
|
|
226
|
+
' --use-string-arrays '
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
// Assert
|
|
230
|
+
expect(testLine).toBe(expected);
|
|
231
|
+
});
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import {
|
|
4
|
+
crudeMultilineTakeUntil,
|
|
5
|
+
collapseWhitespace,
|
|
6
|
+
node14Compatibility,
|
|
7
|
+
} from '../utils/utils.js';
|
|
8
|
+
|
|
9
|
+
node14Compatibility();
|
|
10
|
+
|
|
11
|
+
const exec = promisify(cp.exec);
|
|
12
|
+
const CMD = 'frodo journey import --help';
|
|
13
|
+
const { stdout } = await exec(CMD);
|
|
14
|
+
|
|
15
|
+
test("CLI help interface for 'journey import' Usage should be expected english", async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const expected = `
|
|
18
|
+
Usage: frodo journey import [options] <host> [realm] [user] [password]
|
|
19
|
+
`.trim();
|
|
20
|
+
// Act
|
|
21
|
+
const testLine = stdout
|
|
22
|
+
.split(/\n/)
|
|
23
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
24
|
+
.trim();
|
|
25
|
+
// Assert
|
|
26
|
+
expect(testLine).toBe(expected);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("CLI help interface 'journey import' description at line 2 should be expected english", async () => {
|
|
30
|
+
// Arrange
|
|
31
|
+
const expected = `
|
|
32
|
+
Import journey/tree.
|
|
33
|
+
`.trim();
|
|
34
|
+
// Act
|
|
35
|
+
const testLine = stdout
|
|
36
|
+
.split(/\n/)
|
|
37
|
+
.map((line) => line.trim())
|
|
38
|
+
.at(2);
|
|
39
|
+
// Assert
|
|
40
|
+
expect(testLine).toBe(expected);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("CLI help interface 'import argument host' description should be expected english multiline", async () => {
|
|
44
|
+
// Arrange
|
|
45
|
+
const expected = collapseWhitespace(`
|
|
46
|
+
host Access Management base URL, e.g.:
|
|
47
|
+
https://cdk.iam.example.com/am. To use a connection
|
|
48
|
+
profile, just specify a unique substring.
|
|
49
|
+
`);
|
|
50
|
+
// Act
|
|
51
|
+
const testLine = collapseWhitespace(
|
|
52
|
+
crudeMultilineTakeUntil(
|
|
53
|
+
stdout,
|
|
54
|
+
' host ',
|
|
55
|
+
' realm '
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Assert
|
|
60
|
+
expect(testLine).toBe(expected);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("CLI help interface 'import argument realm' description should be expected english multiline", async () => {
|
|
64
|
+
// Arrange
|
|
65
|
+
const expected = collapseWhitespace(`
|
|
66
|
+
realm Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise. (default: "alpha" for Identity Cloud tenants, "/" otherwise.)
|
|
67
|
+
`);
|
|
68
|
+
// Act
|
|
69
|
+
const testLine = collapseWhitespace(
|
|
70
|
+
crudeMultilineTakeUntil(
|
|
71
|
+
stdout,
|
|
72
|
+
' realm ',
|
|
73
|
+
' user '
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Assert
|
|
78
|
+
expect(testLine).toBe(expected);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("CLI help interface 'import argument user' description should be expected english multiline", async () => {
|
|
82
|
+
// Arrange
|
|
83
|
+
const expected = collapseWhitespace(`
|
|
84
|
+
user Username to login with. Must be an admin user with appropriate
|
|
85
|
+
rights to manage authentication journeys/trees.
|
|
86
|
+
`);
|
|
87
|
+
// Act
|
|
88
|
+
const testLine = collapseWhitespace(
|
|
89
|
+
crudeMultilineTakeUntil(
|
|
90
|
+
stdout,
|
|
91
|
+
' user ',
|
|
92
|
+
' password '
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Assert
|
|
97
|
+
expect(testLine).toBe(expected);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("CLI help interface 'import argument password' description should be expected english", async () => {
|
|
101
|
+
// Arrange
|
|
102
|
+
const expectedDescription = `
|
|
103
|
+
password Password.
|
|
104
|
+
`.trim();
|
|
105
|
+
// Act
|
|
106
|
+
const testLine = stdout
|
|
107
|
+
.split(/\n/)
|
|
108
|
+
.find((line) => line.trim().startsWith('password'))
|
|
109
|
+
.trim();
|
|
110
|
+
// Assert
|
|
111
|
+
expect(testLine).toBe(expectedDescription);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("CLI help interface 'import option -m, --type <type>' description should be expected english multiline", async () => {
|
|
115
|
+
// Arrange
|
|
116
|
+
const expected = collapseWhitespace(`
|
|
117
|
+
-m, --type <type> Override auto-detected deployment type. Valid values for
|
|
118
|
+
type:
|
|
119
|
+
classic: A classic Access Management-only deployment
|
|
120
|
+
with custom layout and configuration.
|
|
121
|
+
cloud: A ForgeRock Identity Cloud environment.
|
|
122
|
+
forgeops: A ForgeOps CDK or CDM deployment.
|
|
123
|
+
The detected or provided deployment type controls certain
|
|
124
|
+
behavior like obtaining an Identity Management admin
|
|
125
|
+
token or not and whether to export/import referenced
|
|
126
|
+
email templates or how to walk through the tenant admin
|
|
127
|
+
login flow of Identity Cloud and handle MFA (choices:
|
|
128
|
+
"classic", "cloud", "forgeops")
|
|
129
|
+
`);
|
|
130
|
+
// Act
|
|
131
|
+
const testLine = collapseWhitespace(
|
|
132
|
+
crudeMultilineTakeUntil(
|
|
133
|
+
stdout,
|
|
134
|
+
' -m, --type <type> ',
|
|
135
|
+
' -k, --insecure '
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Assert
|
|
140
|
+
expect(testLine).toBe(expected);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test("CLI help interface 'import option -k, --insecure' description should be expected english multiline", async () => {
|
|
144
|
+
// Arrange
|
|
145
|
+
const expected = collapseWhitespace(`
|
|
146
|
+
-k, --insecure Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https
|
|
147
|
+
(HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability. (default:
|
|
148
|
+
Don't allow insecure connections)
|
|
149
|
+
`);
|
|
150
|
+
// Act
|
|
151
|
+
const testLine = collapseWhitespace(
|
|
152
|
+
crudeMultilineTakeUntil(
|
|
153
|
+
stdout,
|
|
154
|
+
' -k, --insecure ',
|
|
155
|
+
' -i, --journey-id <journey> '
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
// Assert
|
|
160
|
+
expect(testLine).toBe(expected);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("CLI help interface 'describe option -t, --tree <tree>' description should be expected english", async () => {
|
|
164
|
+
// Arrange
|
|
165
|
+
const expectedDescription = `
|
|
166
|
+
-i, --journey-id <journey> Name of a journey/tree. If specified, -a and -A are ignored.
|
|
167
|
+
`.trim();
|
|
168
|
+
// Act
|
|
169
|
+
const testLine = collapseWhitespace(
|
|
170
|
+
crudeMultilineTakeUntil(
|
|
171
|
+
stdout,
|
|
172
|
+
' -i, --journey-id <journey> ',
|
|
173
|
+
' -f, --file <file> '
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
// Assert
|
|
177
|
+
expect(testLine).toBe(expectedDescription);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("CLI help interface 'import option -f, --file <file>' description should be expected english", async () => {
|
|
181
|
+
// Arrange
|
|
182
|
+
const expected = collapseWhitespace(`
|
|
183
|
+
-f, --file <file> Name of the file to import the journey(s) from. Ignored with -A.
|
|
184
|
+
`);
|
|
185
|
+
// Act
|
|
186
|
+
const testLine = collapseWhitespace(
|
|
187
|
+
crudeMultilineTakeUntil(
|
|
188
|
+
stdout,
|
|
189
|
+
' -f, --file <file> ',
|
|
190
|
+
' -a, --all '
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
// Assert
|
|
194
|
+
expect(testLine).toBe(expected);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test("CLI help interface 'import option --re-uuid' description should be expected english multiline", async () => {
|
|
198
|
+
// Arrange
|
|
199
|
+
const expected = collapseWhitespace(`
|
|
200
|
+
--re-uuid Generate new UUIDs for all nodes during import. (default: off)
|
|
201
|
+
`);
|
|
202
|
+
// Act
|
|
203
|
+
const testLine = collapseWhitespace(
|
|
204
|
+
crudeMultilineTakeUntil(
|
|
205
|
+
stdout,
|
|
206
|
+
' --re-uuid ',
|
|
207
|
+
' --no-deps '
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
// Assert
|
|
211
|
+
expect(testLine).toBe(expected);
|
|
212
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import {
|
|
4
|
+
crudeMultilineTakeUntil,
|
|
5
|
+
collapseWhitespace,
|
|
6
|
+
node14Compatibility,
|
|
7
|
+
} from '../utils/utils.js';
|
|
8
|
+
|
|
9
|
+
node14Compatibility();
|
|
10
|
+
|
|
11
|
+
const exec = promisify(cp.exec);
|
|
12
|
+
const CMD = 'frodo journey list --help';
|
|
13
|
+
const { stdout } = await exec(CMD);
|
|
14
|
+
|
|
15
|
+
test("CLI help interface for 'journey list' Usage should be expected english", async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const expected = `
|
|
18
|
+
Usage: frodo journey list [options] <host> [realm] [user] [password]
|
|
19
|
+
`.trim();
|
|
20
|
+
// Act
|
|
21
|
+
const testLine = stdout
|
|
22
|
+
.split(/\n/)
|
|
23
|
+
.find((line) => line.trim().startsWith('Usage:'))
|
|
24
|
+
.trim();
|
|
25
|
+
// Assert
|
|
26
|
+
expect(testLine).toBe(expected);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("CLI help interface 'journey list' description at line 2 should be expected english", async () => {
|
|
30
|
+
// Arrange
|
|
31
|
+
const expected = `
|
|
32
|
+
List journeys/trees.
|
|
33
|
+
`.trim();
|
|
34
|
+
// Act
|
|
35
|
+
const testLine = stdout
|
|
36
|
+
.split(/\n/)
|
|
37
|
+
.map((line) => line.trim())
|
|
38
|
+
.at(2);
|
|
39
|
+
// Assert
|
|
40
|
+
expect(testLine).toBe(expected);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("CLI help interface 'list argument host' description should be expected english multiline", async () => {
|
|
44
|
+
// Arrange
|
|
45
|
+
const expected = collapseWhitespace(`
|
|
46
|
+
host Access Management base URL, e.g.:
|
|
47
|
+
https://cdk.iam.example.com/am. To use a connection
|
|
48
|
+
profile, just specify a unique substring.
|
|
49
|
+
`);
|
|
50
|
+
// Act
|
|
51
|
+
const testLine = collapseWhitespace(
|
|
52
|
+
crudeMultilineTakeUntil(
|
|
53
|
+
stdout,
|
|
54
|
+
' host ',
|
|
55
|
+
' realm '
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Assert
|
|
60
|
+
expect(testLine).toBe(expected);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("CLI help interface 'list argument realm' description should be expected english multiline", async () => {
|
|
64
|
+
// Arrange
|
|
65
|
+
const expected = collapseWhitespace(`
|
|
66
|
+
realm Realm. Specify realm as '/' for the root realm or 'realm' or '/parent/child' otherwise. (default: "alpha" for Identity Cloud tenants, "/" otherwise.)
|
|
67
|
+
`);
|
|
68
|
+
// Act
|
|
69
|
+
const testLine = collapseWhitespace(
|
|
70
|
+
crudeMultilineTakeUntil(
|
|
71
|
+
stdout,
|
|
72
|
+
' realm ',
|
|
73
|
+
' user '
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Assert
|
|
78
|
+
expect(testLine).toBe(expected);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("CLI help interface 'list argument user' description should be expected english multiline", async () => {
|
|
82
|
+
// Arrange
|
|
83
|
+
const expected = collapseWhitespace(`
|
|
84
|
+
user Username to login with. Must be an admin user with appropriate
|
|
85
|
+
rights to manage authentication journeys/trees.
|
|
86
|
+
`);
|
|
87
|
+
// Act
|
|
88
|
+
const testLine = collapseWhitespace(
|
|
89
|
+
crudeMultilineTakeUntil(
|
|
90
|
+
stdout,
|
|
91
|
+
' user ',
|
|
92
|
+
' password '
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Assert
|
|
97
|
+
expect(testLine).toBe(expected);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("CLI help interface 'list argument password' description should be expected english", async () => {
|
|
101
|
+
// Arrange
|
|
102
|
+
const expectedDescription = `
|
|
103
|
+
password Password.
|
|
104
|
+
`.trim();
|
|
105
|
+
// Act
|
|
106
|
+
const testLine = stdout
|
|
107
|
+
.split(/\n/)
|
|
108
|
+
.find((line) => line.trim().startsWith('password'))
|
|
109
|
+
.trim();
|
|
110
|
+
// Assert
|
|
111
|
+
expect(testLine).toBe(expectedDescription);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("CLI help interface 'list option -m, --type <type>' description should be expected english multiline", async () => {
|
|
115
|
+
// Arrange
|
|
116
|
+
const expected = collapseWhitespace(`
|
|
117
|
+
-m, --type <type> Override auto-detected deployment type. Valid values for
|
|
118
|
+
type:
|
|
119
|
+
classic: A classic Access Management-only deployment
|
|
120
|
+
with custom layout and configuration.
|
|
121
|
+
cloud: A ForgeRock Identity Cloud environment.
|
|
122
|
+
forgeops: A ForgeOps CDK or CDM deployment.
|
|
123
|
+
The detected or provided deployment type controls certain
|
|
124
|
+
behavior like obtaining an Identity Management admin
|
|
125
|
+
token or not and whether to export/import referenced
|
|
126
|
+
email templates or how to walk through the tenant admin
|
|
127
|
+
login flow of Identity Cloud and handle MFA (choices:
|
|
128
|
+
"classic", "cloud", "forgeops")
|
|
129
|
+
`);
|
|
130
|
+
// Act
|
|
131
|
+
const testLine = collapseWhitespace(
|
|
132
|
+
crudeMultilineTakeUntil(
|
|
133
|
+
stdout,
|
|
134
|
+
' -m, --type <type> ',
|
|
135
|
+
' -k, --insecure '
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Assert
|
|
140
|
+
expect(testLine).toBe(expected);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test("CLI help interface 'list option -k, --insecure' description should be expected english multiline", async () => {
|
|
144
|
+
// Arrange
|
|
145
|
+
const expected = collapseWhitespace(`
|
|
146
|
+
-k, --insecure Allow insecure connections when using SSL/TLS. Has no effect when using a network proxy for https (HTTPS_PROXY=http://<host>:<port>), in that case the proxy must provide this capability. (default: Don't allow insecure connections) -l, --long Long with all fields. (default: false)
|
|
147
|
+
`);
|
|
148
|
+
// Act
|
|
149
|
+
const testLine = collapseWhitespace(
|
|
150
|
+
crudeMultilineTakeUntil(
|
|
151
|
+
stdout,
|
|
152
|
+
' -k, --insecure ',
|
|
153
|
+
' -a, --analyze '
|
|
154
|
+
)
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Assert
|
|
158
|
+
expect(testLine).toBe(expected);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("CLI help interface 'list option --analyze' description should be expected english", async () => {
|
|
162
|
+
// Arrange
|
|
163
|
+
const expectedDescription = `
|
|
164
|
+
-a, --analyze Analyze journeys for custom nodes.
|
|
165
|
+
`.trim();
|
|
166
|
+
// Act
|
|
167
|
+
const testLine = stdout
|
|
168
|
+
.split(/\n/)
|
|
169
|
+
.find((line) => line.trim().startsWith('-a, --analyze'))
|
|
170
|
+
.trim();
|
|
171
|
+
// Assert
|
|
172
|
+
expect(testLine).toBe(expectedDescription);
|
|
173
|
+
});
|