generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: can assign a permset to a remote user
- Loading branch information
1 parent
9e476f1
commit 65d5292
Showing
3 changed files
with
17 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,26 +6,16 @@ | |
*/ | ||
|
||
import { $$, expect, test } from '@salesforce/command/lib/test'; | ||
import { Aliases, AuthInfo, Connection, Org, User } from '@salesforce/core'; | ||
import { StubbedType, stubInterface, stubMethod } from '@salesforce/ts-sinon'; | ||
import { MockTestOrgData } from '@salesforce/core/lib/testSetup'; | ||
import { Aliases, Connection, Org, User } from '@salesforce/core'; | ||
import { stubMethod } from '@salesforce/ts-sinon'; | ||
|
||
describe('force:user:permset:assign', () => { | ||
let authInfoStub: StubbedType<AuthInfo>; | ||
const testData = new MockTestOrgData(); | ||
|
||
async function prepareStubs(throws = false) { | ||
const authFields = await testData.getConfig(); | ||
authInfoStub = stubInterface<AuthInfo>($$.SANDBOX, { getFields: () => authFields }); | ||
|
||
stubMethod($$.SANDBOX, AuthInfo, 'create').callsFake(async () => authInfoStub); | ||
stubMethod($$.SANDBOX, Connection, 'create').callsFake(async () => Connection.prototype); | ||
stubMethod($$.SANDBOX, Org.prototype, 'getConnection').returns(Connection.prototype); | ||
stubMethod($$.SANDBOX, Connection.prototype, 'query').resolves({ records: [{ Id: 1234567890 }] }); | ||
stubMethod($$.SANDBOX, Org, 'create').callsFake(async () => Org.prototype); | ||
stubMethod($$.SANDBOX, Org.prototype, 'getUsername').returns('[email protected]'); | ||
stubMethod($$.SANDBOX, User, 'create').callsFake(async () => User.prototype); | ||
stubMethod($$.SANDBOX, User.prototype, 'retrieve').resolves({ | ||
id: '0052D0000043PawWWR', | ||
}); | ||
if (throws) { | ||
stubMethod($$.SANDBOX, User.prototype, 'assignPermissionSets').throws( | ||
new Error('Permission set "abc" not found in target org. Do you need to push source?') | ||
|