Skip to content

Commit

Permalink
fix: pass installation key when getting external sites
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed Aug 23, 2022
1 parent 4680be9 commit 982a2f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/force/package/beta/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class Install extends SfdxCommand {
}

private async confirmExternalSites(request: PackageInstallCreateRequest, noPrompt: boolean): Promise<void> {
const extSites = await this.pkg.getExternalSites(request.SubscriberPackageVersionKey);
const extSites = await this.pkg.getExternalSites(request.SubscriberPackageVersionKey, request.Password);
if (extSites) {
let enableRss = true;
if (!noPrompt) {
Expand Down
19 changes: 19 additions & 0 deletions test/commands/force/package/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,25 @@ describe('force:package:install', () => {
expect(result).to.deep.equal(pkgInstallRequest);
});

it('should NOT confirm external sites with --noprompt flag and installation key', async () => {
const installationkey = '1234abcd';
const expectedCreateRequest = Object.assign({}, pkgInstallCreateRequest, {
EnableRss: true,
Password: installationkey,
});
getExternalSitesStub.resolves(extSites);
installStub.resolves(pkgInstallRequest);

const result = await runCmd(['-p', '04t6A000002zgKSQAY', '--noprompt', '-k', installationkey], true);

expect(getExternalSitesStub.calledOnce).to.be.true;
expect(getExternalSitesStub.args[0][0]).to.equal(pkgInstallCreateRequest.SubscriberPackageVersionKey);
expect(getExternalSitesStub.args[0][1]).to.equal(installationkey);
expect(uxConfirmStub.calledOnce).to.be.false;
expect(installStub.args[0][0]).to.deep.equal(expectedCreateRequest);
expect(result).to.deep.equal(pkgInstallRequest);
});

it('should confirm external sites when NO --noprompt flag (yes answer)', async () => {
const expectedCreateRequest = Object.assign({}, pkgInstallCreateRequest, { EnableRss: true });
getExternalSitesStub.resolves(extSites);
Expand Down

0 comments on commit 982a2f2

Please sign in to comment.