@unito/integration-cli 1.3.5 → 1.5.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/dist/boilerplate/package-lock.json +6 -6
- package/dist/schemas/configuration.json +3 -15
- package/dist/src/commands/activity.js +5 -6
- package/dist/src/commands/dev.d.ts +0 -1
- package/dist/src/commands/dev.js +15 -24
- package/dist/src/commands/encrypt.js +3 -4
- package/dist/src/commands/graph.d.ts +0 -1
- package/dist/src/commands/graph.js +14 -23
- package/dist/src/commands/invite.js +5 -6
- package/dist/src/commands/login.js +4 -5
- package/dist/src/commands/oauth2.d.ts +0 -1
- package/dist/src/commands/oauth2.js +17 -39
- package/dist/src/commands/publish.js +7 -8
- package/dist/src/commands/schema-snapshot.js +9 -15
- package/dist/src/commands/test.js +15 -24
- package/dist/src/configurationTypes.d.ts +3 -14
- package/dist/src/resources/configuration.d.ts +1 -5
- package/dist/src/resources/configuration.js +11 -28
- package/dist/test/commands/dev.test.js +4 -6
- package/dist/test/commands/encrypt.test.js +2 -2
- package/dist/test/commands/graph.test.js +1 -3
- package/dist/test/commands/oauth2.test.js +36 -64
- package/dist/test/commands/publish.test.js +23 -23
- package/dist/test/commands/test.test.js +5 -18
- package/dist/test/resources/configuration.test.js +28 -80
- package/dist/test/resources/decryption.test.js +3 -8
- package/oclif.manifest.json +14 -70
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ describe('Publish', () => {
|
|
|
45
45
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
|
|
46
46
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
47
47
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
48
|
-
.command(['publish'])
|
|
48
|
+
.command(['publish', '--environment=production'])
|
|
49
49
|
.it('publish the integration - default', ctx => {
|
|
50
50
|
(0, test_1.expect)(ctx.stdout).to.contain('published');
|
|
51
51
|
});
|
|
@@ -55,7 +55,7 @@ describe('Publish', () => {
|
|
|
55
55
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
|
|
56
56
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
57
57
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
58
|
-
.command(['publish', '--config-path', '/custom-config.json'])
|
|
58
|
+
.command(['publish', '--config-path', '/custom-config.json', '--environment=production'])
|
|
59
59
|
.it('publish the integration with custom config - default', ctx => {
|
|
60
60
|
(0, test_1.expect)(ctx.stdout).to.contain('published');
|
|
61
61
|
});
|
|
@@ -111,7 +111,7 @@ describe('Publish', () => {
|
|
|
111
111
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
|
|
112
112
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
113
113
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
114
|
-
.command(['publish', '--config-path', '/my-awesome-config.json'])
|
|
114
|
+
.command(['publish', '--config-path', '/my-awesome-config.json', '--environment=production'])
|
|
115
115
|
.it('publish the integration using custom configuration', ctx => {
|
|
116
116
|
(0, test_1.expect)(ctx.stdout).to.contain('published');
|
|
117
117
|
});
|
|
@@ -122,7 +122,7 @@ describe('Publish', () => {
|
|
|
122
122
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
123
123
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
124
124
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: false }))
|
|
125
|
-
.command(['publish', '--registry-only'])
|
|
125
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
126
126
|
.it('aborts on user negative input', ctx => {
|
|
127
127
|
(0, test_1.expect)(ctx.stdout).to.contain('🙊 Abort! You are safe now 🍸 relax');
|
|
128
128
|
});
|
|
@@ -135,7 +135,7 @@ describe('Publish', () => {
|
|
|
135
135
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
136
136
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
137
137
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: false }))
|
|
138
|
-
.command(['publish', '--registry-only', '--force'])
|
|
138
|
+
.command(['publish', '--registry-only', '--force', '--environment=production'])
|
|
139
139
|
.it('bypass user confirmation with --force is active', ctx => {
|
|
140
140
|
(0, test_1.expect)(ctx.stdout).to.contain('created');
|
|
141
141
|
});
|
|
@@ -148,7 +148,7 @@ describe('Publish', () => {
|
|
|
148
148
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
149
149
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
150
150
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
|
|
151
|
-
.command(['publish', '--registry-only'])
|
|
151
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
152
152
|
.it('creates the integration in the registry', ctx => {
|
|
153
153
|
(0, test_1.expect)(ctx.stdout).to.contain('created');
|
|
154
154
|
});
|
|
@@ -161,7 +161,7 @@ describe('Publish', () => {
|
|
|
161
161
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
162
162
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
163
163
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
|
|
164
|
-
.command(['publish', '--registry-only'])
|
|
164
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
165
165
|
.it('updates the integration in the registry', ctx => {
|
|
166
166
|
(0, test_1.expect)(ctx.stdout).to.contain('updated');
|
|
167
167
|
});
|
|
@@ -176,7 +176,7 @@ describe('Publish', () => {
|
|
|
176
176
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
177
177
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
178
178
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
|
|
179
|
-
.command(['publish', '--registry-only'])
|
|
179
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
180
180
|
.it('filters out "development" authorizations', ctx => {
|
|
181
181
|
ctx.sandbox.assert.calledOnceWithMatch(
|
|
182
182
|
// @ts-expect-error syntax accepted by sinon.
|
|
@@ -200,7 +200,7 @@ describe('Publish', () => {
|
|
|
200
200
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
201
201
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
202
202
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
203
|
-
.command(['publish', '--preview'])
|
|
203
|
+
.command(['publish', '--preview', '--environment=production'])
|
|
204
204
|
.it('preview the integration', ctx => {
|
|
205
205
|
(0, test_1.expect)(ctx.stdout).to.contain('published');
|
|
206
206
|
});
|
|
@@ -211,7 +211,7 @@ describe('Publish', () => {
|
|
|
211
211
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
212
212
|
.stub(IntegrationConfiguration, 'writeConfiguration', stub => stub.returns(integration))
|
|
213
213
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
214
|
-
.command(['publish', '--preview'])
|
|
214
|
+
.command(['publish', '--preview', '--environment=production'])
|
|
215
215
|
.it('preview the integration - override the display name', ctx => {
|
|
216
216
|
(0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('foo-preview-9c88 is being published');
|
|
217
217
|
});
|
|
@@ -223,7 +223,7 @@ describe('Publish', () => {
|
|
|
223
223
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
224
224
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
225
225
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
226
|
-
.command(['publish', '--live-preview'])
|
|
226
|
+
.command(['publish', '--live-preview', '--environment=production'])
|
|
227
227
|
.it('live-preview the integration', ctx => {
|
|
228
228
|
(0, test_1.expect)(ctx.stdout).to.contain('created');
|
|
229
229
|
});
|
|
@@ -234,7 +234,7 @@ describe('Publish', () => {
|
|
|
234
234
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
235
235
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
236
236
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
237
|
-
.command(['publish', '--live-preview'])
|
|
237
|
+
.command(['publish', '--live-preview', '--environment=production'])
|
|
238
238
|
.it('live-preview the integration - override the display name', ctx => {
|
|
239
239
|
ctx.sandbox.assert.calledOnceWithMatch(
|
|
240
240
|
// @ts-expect-error syntax accepted by sinon.
|
|
@@ -251,7 +251,7 @@ describe('Publish', () => {
|
|
|
251
251
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({}))
|
|
252
252
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
253
253
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
254
|
-
.command(['publish'])
|
|
254
|
+
.command(['publish', '--environment=production'])
|
|
255
255
|
.exit(-1)
|
|
256
256
|
.it('missing api key', ctx => {
|
|
257
257
|
(0, test_1.expect)(ctx.stderr).to.contain('Your API key is not set!\nMake sure to run the login command first');
|
|
@@ -261,7 +261,7 @@ describe('Publish', () => {
|
|
|
261
261
|
.stderr()
|
|
262
262
|
.stub(GlobalConfiguration, 'read', stub => stub.throws(new errors_1.NoConfigurationFileError()))
|
|
263
263
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
264
|
-
.command(['publish'])
|
|
264
|
+
.command(['publish', '--environment=production'])
|
|
265
265
|
.exit(-1)
|
|
266
266
|
.it('handles exception');
|
|
267
267
|
test_1.test
|
|
@@ -279,7 +279,7 @@ describe('Publish', () => {
|
|
|
279
279
|
}))
|
|
280
280
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
281
281
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
282
|
-
.command(['publish', '--preview'])
|
|
282
|
+
.command(['publish', '--preview', '--environment=production'])
|
|
283
283
|
.it('reencrypts the clientSecret on preview', ctx => {
|
|
284
284
|
(0, test_1.expect)(ctx.stdout).to.contain('Reencrypting oauth2:clientSecret');
|
|
285
285
|
(0, test_1.expect)(ctx.stdout).to.contain('Reencrypting secrets:secret1');
|
|
@@ -297,7 +297,7 @@ describe('Publish', () => {
|
|
|
297
297
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
298
298
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
299
299
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
300
|
-
.command(['publish', '--live-preview'])
|
|
300
|
+
.command(['publish', '--live-preview', '--environment=production'])
|
|
301
301
|
.it('reencrypts the clientSecret on live-preview', ctx => {
|
|
302
302
|
(0, test_1.expect)(ctx.stdout).to.contain('Reencrypting oauth2:clientSecret');
|
|
303
303
|
(0, test_1.expect)(ctx.stdout).to.contain('Reencrypting secrets:secret1');
|
|
@@ -314,7 +314,7 @@ describe('Publish', () => {
|
|
|
314
314
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
315
315
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
316
316
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
317
|
-
.command(['publish', '--live-preview'])
|
|
317
|
+
.command(['publish', '--live-preview', '--environment=production'])
|
|
318
318
|
.it('skips reencryption', ctx => {
|
|
319
319
|
(0, test_1.expect)(ctx.stdout).to.contain('Skipping oauth2:clientSecret');
|
|
320
320
|
});
|
|
@@ -334,7 +334,7 @@ describe('Publish', () => {
|
|
|
334
334
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
335
335
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('foo')))
|
|
336
336
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
|
|
337
|
-
.command(['publish', '--registry-only'])
|
|
337
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
338
338
|
.it('update assets', ctx => {
|
|
339
339
|
(0, test_1.expect)(ctx.stdout).to.contain('image: <set>');
|
|
340
340
|
(0, test_1.expect)(ctx.stdout).to.contain('markdown: <set>');
|
|
@@ -355,7 +355,7 @@ describe('Publish', () => {
|
|
|
355
355
|
.stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
|
|
356
356
|
.stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
|
|
357
357
|
.stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
|
|
358
|
-
.command(['publish', '--registry-only'])
|
|
358
|
+
.command(['publish', '--registry-only', '--environment=production'])
|
|
359
359
|
.it('it defaults instructions to null if no file in assets folder', ctx => {
|
|
360
360
|
(0, test_1.expect)(ctx.stdout).to.contain('image: <unset>');
|
|
361
361
|
(0, test_1.expect)(ctx.stdout).to.contain('markdown: <unset>');
|
|
@@ -444,7 +444,7 @@ describe('Publish', () => {
|
|
|
444
444
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
|
|
445
445
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
446
446
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
447
|
-
.command(['publish', '--display-name', 'PR-1234'])
|
|
447
|
+
.command(['publish', '--display-name', 'PR-1234', '--environment=production'])
|
|
448
448
|
.exit(-1)
|
|
449
449
|
.it('rejects --display-name without --preview or --live-preview', ctx => {
|
|
450
450
|
(0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('--display-name is only supported with --preview, --live-preview, or --environment=local');
|
|
@@ -474,7 +474,7 @@ describe('Publish', () => {
|
|
|
474
474
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
475
475
|
.stub(IntegrationConfiguration, 'writeConfiguration', stub => stub.returns(integration))
|
|
476
476
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
477
|
-
.command(['publish', '--preview', '--display-name', 'PR-1234'])
|
|
477
|
+
.command(['publish', '--preview', '--display-name', 'PR-1234', '--environment=production'])
|
|
478
478
|
.it('private preview - --display-name overrides the base, hash suffix still appended', ctx => {
|
|
479
479
|
(0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('foo-preview-9c88 is being published');
|
|
480
480
|
ctx.sandbox.assert.calledWithMatch(
|
|
@@ -534,7 +534,7 @@ describe('Publish', () => {
|
|
|
534
534
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
|
|
535
535
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
536
536
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
537
|
-
.command(['publish', '--visibility=public', '--registry-only'])
|
|
537
|
+
.command(['publish', '--visibility=public', '--registry-only', '--environment=production'])
|
|
538
538
|
.exit(2)
|
|
539
539
|
.it('oclif rejects --visibility + --registry-only (exclusive)', _ctx => { });
|
|
540
540
|
test_1.test
|
|
@@ -544,7 +544,7 @@ describe('Publish', () => {
|
|
|
544
544
|
.stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
|
|
545
545
|
.stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
|
|
546
546
|
.stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
|
|
547
|
-
.command(['publish', '--display-name=Foo', '--registry-only'])
|
|
547
|
+
.command(['publish', '--display-name=Foo', '--registry-only', '--environment=production'])
|
|
548
548
|
.exit(2)
|
|
549
549
|
.it('oclif rejects --display-name + --registry-only (exclusive)', _ctx => { });
|
|
550
550
|
});
|
|
@@ -23,14 +23,9 @@ describe('Test', () => {
|
|
|
23
23
|
success: '',
|
|
24
24
|
failure: '',
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
encryptedToken: `${ConfigurationResource.ENCRYPTION_PREFIX}decrypt-me`,
|
|
30
|
-
},
|
|
31
|
-
development: {
|
|
32
|
-
accessToken: 'developmentToken',
|
|
33
|
-
},
|
|
26
|
+
testAccount: {
|
|
27
|
+
accessToken: 'token',
|
|
28
|
+
encryptedToken: `${ConfigurationResource.ENCRYPTION_PREFIX}decrypt-me`,
|
|
34
29
|
},
|
|
35
30
|
};
|
|
36
31
|
let execSyncStub;
|
|
@@ -102,16 +97,8 @@ describe('Test', () => {
|
|
|
102
97
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
103
98
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
104
99
|
.command(['test'])
|
|
105
|
-
.it('
|
|
106
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"
|
|
107
|
-
});
|
|
108
|
-
test_1.test
|
|
109
|
-
.stdout()
|
|
110
|
-
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
111
|
-
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
112
|
-
.command(['test', '--test-account', 'compliance'])
|
|
113
|
-
.it('uses compliance credentials when a flag is provided', () => {
|
|
114
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"token","encryptedToken":"decrypted-me","unitoCredentialId":"compliance","unitoUserId":"compliance"}');
|
|
100
|
+
.it('uses the configured test account credentials', () => {
|
|
101
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"token","encryptedToken":"decrypted-me","unitoCredentialId":"testAccount","unitoUserId":"testAccount"}');
|
|
115
102
|
});
|
|
116
103
|
test_1.test
|
|
117
104
|
.stdout()
|
|
@@ -16,10 +16,8 @@ describe('configuration', () => {
|
|
|
16
16
|
beforeEach(async () => {
|
|
17
17
|
originalConfiguration = {
|
|
18
18
|
name: 'my-integration',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
accessToken: 'foo',
|
|
22
|
-
},
|
|
19
|
+
testAccount: {
|
|
20
|
+
accessToken: 'foo',
|
|
23
21
|
},
|
|
24
22
|
};
|
|
25
23
|
// Create a temporary directory
|
|
@@ -258,25 +256,16 @@ describe('configuration', () => {
|
|
|
258
256
|
},
|
|
259
257
|
},
|
|
260
258
|
],
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
compliance: {
|
|
268
|
-
apiKey: 'xyzw',
|
|
269
|
-
displayName: 'My Awesome Nickname from first grade',
|
|
270
|
-
email: 'manualtester+staging@unito.io',
|
|
271
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
272
|
-
},
|
|
259
|
+
testAccount: {
|
|
260
|
+
apiKey: 'xyzw',
|
|
261
|
+
displayName: 'My Awesome Nickname from first grade',
|
|
262
|
+
email: 'manualtester+staging@unito.io',
|
|
263
|
+
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
273
264
|
},
|
|
274
265
|
}, null, 2));
|
|
275
266
|
const configuration = await Configuration.getConfiguration(globalConfiguration_1.Environment.Production);
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
strict_1.default.equal(developmentKey, 'xyz');
|
|
279
|
-
strict_1.default.equal(complianceKey, 'xyzw');
|
|
267
|
+
const apiKey = configuration.testAccount?.apiKey;
|
|
268
|
+
strict_1.default.equal(apiKey, 'xyzw');
|
|
280
269
|
});
|
|
281
270
|
it('invalid test accounts', async () => {
|
|
282
271
|
await fs_1.default.promises.writeFile(Configuration.getConfigurationPath(), JSON.stringify({
|
|
@@ -299,19 +288,11 @@ describe('configuration', () => {
|
|
|
299
288
|
},
|
|
300
289
|
},
|
|
301
290
|
],
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
308
|
-
},
|
|
309
|
-
compliance: {
|
|
310
|
-
APIKEY: 'xyzw',
|
|
311
|
-
displayName: 'My Awesome Nickname from first grade',
|
|
312
|
-
email: 'manualtester+staging@unito.io',
|
|
313
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
314
|
-
},
|
|
291
|
+
testAccount: {
|
|
292
|
+
APIKEY: 'xyzw',
|
|
293
|
+
displayName: 'My Awesome Nickname from first grade',
|
|
294
|
+
email: 'manualtester+staging@unito.io',
|
|
295
|
+
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
315
296
|
},
|
|
316
297
|
}, null, 2));
|
|
317
298
|
await strict_1.default.rejects(Configuration.getConfiguration(globalConfiguration_1.Environment.Production), errors_1.ConfigurationInvalid);
|
|
@@ -377,25 +358,15 @@ describe('configuration', () => {
|
|
|
377
358
|
},
|
|
378
359
|
},
|
|
379
360
|
],
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
email: 'manualtester+staging@unito.io',
|
|
385
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
386
|
-
},
|
|
387
|
-
compliance: {
|
|
388
|
-
accessToken: 'Super_Secret_token_2',
|
|
389
|
-
email: 'manualtester+staging@unito.io',
|
|
390
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
391
|
-
},
|
|
361
|
+
testAccount: {
|
|
362
|
+
accessToken: 'Super_Secret_token_2',
|
|
363
|
+
email: 'manualtester+staging@unito.io',
|
|
364
|
+
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
392
365
|
},
|
|
393
366
|
}, null, 2));
|
|
394
367
|
const configuration = await Configuration.getConfiguration(globalConfiguration_1.Environment.Production);
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
strict_1.default.equal(developmentKey, 'Super_Secret_token');
|
|
398
|
-
strict_1.default.equal(complianceKey, 'Super_Secret_token_2');
|
|
368
|
+
const accessToken = configuration.testAccount?.accessToken;
|
|
369
|
+
strict_1.default.equal(accessToken, 'Super_Secret_token_2');
|
|
399
370
|
});
|
|
400
371
|
it('invalid test accounts', async () => {
|
|
401
372
|
await fs_1.default.promises.writeFile(Configuration.getConfigurationPath(), JSON.stringify({
|
|
@@ -436,13 +407,8 @@ describe('configuration', () => {
|
|
|
436
407
|
},
|
|
437
408
|
},
|
|
438
409
|
],
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
apiKey: 'xyz',
|
|
442
|
-
},
|
|
443
|
-
compliance: {
|
|
444
|
-
apiKey: 'xyzw',
|
|
445
|
-
},
|
|
410
|
+
testAccount: {
|
|
411
|
+
apiKey: 'xyzw',
|
|
446
412
|
},
|
|
447
413
|
}, null, 2));
|
|
448
414
|
await strict_1.default.rejects(Configuration.getConfiguration(globalConfiguration_1.Environment.Production), errors_1.ConfigurationInvalid);
|
|
@@ -524,23 +490,13 @@ describe('configuration', () => {
|
|
|
524
490
|
},
|
|
525
491
|
},
|
|
526
492
|
],
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
accessToken: 'Super_Secret_token',
|
|
530
|
-
displayName: 'My Awesome Nickname from first grade',
|
|
531
|
-
email: 'manualtester+staging@unito.io',
|
|
532
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
533
|
-
},
|
|
534
|
-
compliance: {
|
|
535
|
-
apiKey: 'Super_Secret_api_key_2',
|
|
536
|
-
},
|
|
493
|
+
testAccount: {
|
|
494
|
+
apiKey: 'Super_Secret_api_key_2',
|
|
537
495
|
},
|
|
538
496
|
}, null, 2));
|
|
539
497
|
const configuration = await Configuration.getConfiguration(globalConfiguration_1.Environment.Production);
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
strict_1.default.equal(developmentKey, 'Super_Secret_token');
|
|
543
|
-
strict_1.default.equal(complianceKey, 'Super_Secret_api_key_2');
|
|
498
|
+
const apiKey = configuration.testAccount?.apiKey;
|
|
499
|
+
strict_1.default.equal(apiKey, 'Super_Secret_api_key_2');
|
|
544
500
|
});
|
|
545
501
|
it('invalid test accounts', async () => {
|
|
546
502
|
await fs_1.default.promises.writeFile(Configuration.getConfigurationPath(), JSON.stringify({
|
|
@@ -597,16 +553,8 @@ describe('configuration', () => {
|
|
|
597
553
|
},
|
|
598
554
|
},
|
|
599
555
|
],
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
accessTokens: 'Super_Secret_token',
|
|
603
|
-
displayName: 'My Awesome Nickname from first grade',
|
|
604
|
-
email: 'manualtester+staging@unito.io',
|
|
605
|
-
domain: 'ftp://unitomanualtests.atlassian.net',
|
|
606
|
-
},
|
|
607
|
-
compliance: {
|
|
608
|
-
apiKeys: 'Super_Secret_api_key_2',
|
|
609
|
-
},
|
|
556
|
+
testAccount: {
|
|
557
|
+
apiKeys: 'Super_Secret_api_key_2',
|
|
610
558
|
},
|
|
611
559
|
}, null, 2));
|
|
612
560
|
await strict_1.default.rejects(Configuration.getConfiguration(globalConfiguration_1.Environment.Production), errors_1.ConfigurationInvalid);
|
|
@@ -16,14 +16,9 @@ describe('decryption helper', () => {
|
|
|
16
16
|
encryptedSecret1: `${configuration_1.ENCRYPTION_PREFIX}decrypt-me`,
|
|
17
17
|
encryptedSecret2: `${configuration_1.ENCRYPTION_PREFIX}decrypt-me`,
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
encryptedToken: `${configuration_1.ENCRYPTION_PREFIX}decrypt-me`,
|
|
23
|
-
},
|
|
24
|
-
development: {
|
|
25
|
-
accessToken: 'developmentToken',
|
|
26
|
-
},
|
|
19
|
+
testAccount: {
|
|
20
|
+
accessToken: 'token',
|
|
21
|
+
encryptedToken: `${configuration_1.ENCRYPTION_PREFIX}decrypt-me`,
|
|
27
22
|
},
|
|
28
23
|
};
|
|
29
24
|
beforeEach(() => {
|
package/oclif.manifest.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"environment": {
|
|
28
28
|
"description": "the environment of the platform",
|
|
29
29
|
"name": "environment",
|
|
30
|
-
"default": "
|
|
30
|
+
"default": "local",
|
|
31
31
|
"hasDynamicHelp": false,
|
|
32
32
|
"multiple": false,
|
|
33
33
|
"options": [
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"environment": {
|
|
81
81
|
"description": "the environment of the platform",
|
|
82
82
|
"name": "environment",
|
|
83
|
-
"default": "
|
|
83
|
+
"default": "local",
|
|
84
84
|
"hasDynamicHelp": false,
|
|
85
85
|
"multiple": false,
|
|
86
86
|
"options": [
|
|
@@ -116,18 +116,6 @@
|
|
|
116
116
|
"multiple": false,
|
|
117
117
|
"type": "option"
|
|
118
118
|
},
|
|
119
|
-
"test-account": {
|
|
120
|
-
"description": "test account to use.",
|
|
121
|
-
"name": "test-account",
|
|
122
|
-
"default": "development",
|
|
123
|
-
"hasDynamicHelp": false,
|
|
124
|
-
"multiple": false,
|
|
125
|
-
"options": [
|
|
126
|
-
"development",
|
|
127
|
-
"compliance"
|
|
128
|
-
],
|
|
129
|
-
"type": "option"
|
|
130
|
-
},
|
|
131
119
|
"read-only": {
|
|
132
120
|
"description": "whether or not to only perform read operations",
|
|
133
121
|
"name": "read-only",
|
|
@@ -220,7 +208,7 @@
|
|
|
220
208
|
"environment": {
|
|
221
209
|
"description": "the environment of the platform",
|
|
222
210
|
"name": "environment",
|
|
223
|
-
"default": "
|
|
211
|
+
"default": "local",
|
|
224
212
|
"hasDynamicHelp": false,
|
|
225
213
|
"multiple": false,
|
|
226
214
|
"options": [
|
|
@@ -305,7 +293,7 @@
|
|
|
305
293
|
"environment": {
|
|
306
294
|
"description": "the environment of the platform",
|
|
307
295
|
"name": "environment",
|
|
308
|
-
"default": "
|
|
296
|
+
"default": "local",
|
|
309
297
|
"hasDynamicHelp": false,
|
|
310
298
|
"multiple": false,
|
|
311
299
|
"options": [
|
|
@@ -315,18 +303,6 @@
|
|
|
315
303
|
],
|
|
316
304
|
"type": "option"
|
|
317
305
|
},
|
|
318
|
-
"test-account": {
|
|
319
|
-
"description": "test account to use",
|
|
320
|
-
"name": "test-account",
|
|
321
|
-
"default": "development",
|
|
322
|
-
"hasDynamicHelp": false,
|
|
323
|
-
"multiple": false,
|
|
324
|
-
"options": [
|
|
325
|
-
"development",
|
|
326
|
-
"compliance"
|
|
327
|
-
],
|
|
328
|
-
"type": "option"
|
|
329
|
-
},
|
|
330
306
|
"credential-payload": {
|
|
331
307
|
"description": "(advanced) credential payload to use.",
|
|
332
308
|
"exclusive": [
|
|
@@ -467,7 +443,7 @@
|
|
|
467
443
|
"environment": {
|
|
468
444
|
"description": "the environment of the platform",
|
|
469
445
|
"name": "environment",
|
|
470
|
-
"default": "
|
|
446
|
+
"default": "local",
|
|
471
447
|
"hasDynamicHelp": false,
|
|
472
448
|
"multiple": false,
|
|
473
449
|
"options": [
|
|
@@ -512,7 +488,7 @@
|
|
|
512
488
|
"environment": {
|
|
513
489
|
"description": "the environment of the platform",
|
|
514
490
|
"name": "environment",
|
|
515
|
-
"default": "
|
|
491
|
+
"default": "local",
|
|
516
492
|
"hasDynamicHelp": false,
|
|
517
493
|
"multiple": false,
|
|
518
494
|
"options": [
|
|
@@ -542,28 +518,16 @@
|
|
|
542
518
|
"oauth2": {
|
|
543
519
|
"aliases": [],
|
|
544
520
|
"args": {},
|
|
545
|
-
"description": "The Oauth2 command allows you to perform an OAuth2 workflow to populate the
|
|
521
|
+
"description": "The Oauth2 command allows you to perform an OAuth2 workflow to populate the test account's accessToken and refreshToken to be used by the 'test' and 'dev' commands.\n\n If the test account is already populated, the command will refresh the credentials if the refresh token is available.\n If you want to force a new OAuth2 flow to change the connected account or something else, use the --reauth flag.",
|
|
546
522
|
"examples": [
|
|
547
523
|
"<%= config.bin %> <%= command.id %>",
|
|
548
|
-
"<%= config.bin %> <%= command.id %> --reauth
|
|
524
|
+
"<%= config.bin %> <%= command.id %> --reauth"
|
|
549
525
|
],
|
|
550
526
|
"flags": {
|
|
551
|
-
"test-account": {
|
|
552
|
-
"description": "Test account to use.",
|
|
553
|
-
"name": "test-account",
|
|
554
|
-
"default": "development",
|
|
555
|
-
"hasDynamicHelp": false,
|
|
556
|
-
"multiple": false,
|
|
557
|
-
"options": [
|
|
558
|
-
"development",
|
|
559
|
-
"compliance"
|
|
560
|
-
],
|
|
561
|
-
"type": "option"
|
|
562
|
-
},
|
|
563
527
|
"environment": {
|
|
564
528
|
"description": "the environment of the platform",
|
|
565
529
|
"name": "environment",
|
|
566
|
-
"default": "
|
|
530
|
+
"default": "local",
|
|
567
531
|
"hasDynamicHelp": false,
|
|
568
532
|
"multiple": false,
|
|
569
533
|
"options": [
|
|
@@ -595,7 +559,7 @@
|
|
|
595
559
|
"pluginName": "@unito/integration-cli",
|
|
596
560
|
"pluginType": "core",
|
|
597
561
|
"strict": true,
|
|
598
|
-
"summary": "Perform an OAuth2 workflow to either populate or refresh
|
|
562
|
+
"summary": "Perform an OAuth2 workflow to either populate or refresh the test account's credentials.",
|
|
599
563
|
"enableJsonFlag": false,
|
|
600
564
|
"isESM": false,
|
|
601
565
|
"relativePath": [
|
|
@@ -623,7 +587,7 @@
|
|
|
623
587
|
"environment": {
|
|
624
588
|
"description": "the environment of the platform",
|
|
625
589
|
"name": "environment",
|
|
626
|
-
"default": "
|
|
590
|
+
"default": "local",
|
|
627
591
|
"hasDynamicHelp": false,
|
|
628
592
|
"multiple": false,
|
|
629
593
|
"options": [
|
|
@@ -754,7 +718,7 @@
|
|
|
754
718
|
"environment": {
|
|
755
719
|
"description": "the environment of the platform",
|
|
756
720
|
"name": "environment",
|
|
757
|
-
"default": "
|
|
721
|
+
"default": "local",
|
|
758
722
|
"hasDynamicHelp": false,
|
|
759
723
|
"multiple": false,
|
|
760
724
|
"options": [
|
|
@@ -764,14 +728,6 @@
|
|
|
764
728
|
],
|
|
765
729
|
"type": "option"
|
|
766
730
|
},
|
|
767
|
-
"test-account": {
|
|
768
|
-
"description": "test account to use",
|
|
769
|
-
"name": "test-account",
|
|
770
|
-
"default": "development",
|
|
771
|
-
"hasDynamicHelp": false,
|
|
772
|
-
"multiple": false,
|
|
773
|
-
"type": "option"
|
|
774
|
-
},
|
|
775
731
|
"config-path": {
|
|
776
732
|
"description": "relative path to a custom \".unito.json\" file",
|
|
777
733
|
"name": "config-path",
|
|
@@ -834,7 +790,7 @@
|
|
|
834
790
|
"environment": {
|
|
835
791
|
"description": "the environment of the platform",
|
|
836
792
|
"name": "environment",
|
|
837
|
-
"default": "
|
|
793
|
+
"default": "local",
|
|
838
794
|
"hasDynamicHelp": false,
|
|
839
795
|
"multiple": false,
|
|
840
796
|
"options": [
|
|
@@ -904,18 +860,6 @@
|
|
|
904
860
|
"multiple": false,
|
|
905
861
|
"type": "option"
|
|
906
862
|
},
|
|
907
|
-
"test-account": {
|
|
908
|
-
"description": "test account to use.",
|
|
909
|
-
"name": "test-account",
|
|
910
|
-
"default": "development",
|
|
911
|
-
"hasDynamicHelp": false,
|
|
912
|
-
"multiple": false,
|
|
913
|
-
"options": [
|
|
914
|
-
"development",
|
|
915
|
-
"compliance"
|
|
916
|
-
],
|
|
917
|
-
"type": "option"
|
|
918
|
-
},
|
|
919
863
|
"read-only": {
|
|
920
864
|
"description": "whether or not to only perform read operations",
|
|
921
865
|
"name": "read-only",
|
|
@@ -1030,5 +974,5 @@
|
|
|
1030
974
|
]
|
|
1031
975
|
}
|
|
1032
976
|
},
|
|
1033
|
-
"version": "1.
|
|
977
|
+
"version": "1.5.0"
|
|
1034
978
|
}
|