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