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.
fix: user:create matches smoke test json
- Loading branch information
Showing
2 changed files
with
100 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,6 @@ describe('force:user:create', () => { | |
lastName: 'User', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
}); | ||
|
||
expect(res).to.deep.equal({ | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
|
@@ -84,6 +83,8 @@ describe('force:user:create', () => { | |
}); | ||
stubMethod($$.SANDBOX, Aliases, 'fetch').resolves('testAlias'); | ||
stubMethod($$.SANDBOX, User, 'create').callsFake(() => User.prototype); | ||
|
||
stubMethod($$.SANDBOX, User.prototype, 'assignPermissionSets').resolves(); | ||
stubMethod($$.SANDBOX, Org.prototype, 'getUsername').returns(username); | ||
stubMethod($$.SANDBOX, Org.prototype, 'getOrgId').returns('abc123'); | ||
authInfoStub = stubMethod($$.SANDBOX, AuthInfo.prototype, 'save').resolves(); | ||
|
@@ -124,21 +125,23 @@ describe('force:user:create', () => { | |
]) | ||
.it('will handle a merge multiple permsets and profileNames from args and file (permsets from args)', (ctx) => { | ||
const expected = { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
orgId: 'abc123', | ||
generatepassword: 'true', | ||
generatePassword: true, | ||
permsets: "'permCLI, permCLI2'", | ||
profileId: '12345678', | ||
profileName: 'profileFromArgs', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
permissionSetAssignments: ['permCLI', 'permCLI2'], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
generatepassword: 'true', | ||
generatePassword: true, | ||
profileId: '12345678', | ||
profileName: 'profileFromArgs', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
|
@@ -164,19 +167,21 @@ describe('force:user:create', () => { | |
]) | ||
.it('will handle a merge multiple permsets and profileNames from args and file (permsets from file)', (ctx) => { | ||
const expected = { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
orgId: 'abc123', | ||
permsets: ['perm1', 'perm2'], | ||
profileId: '12345678', | ||
profileName: 'profileFromArgs', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
permissionSetAssignments: ['perm1', 'perm2'], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
profileId: '12345678', | ||
profileName: 'profileFromArgs', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
|
@@ -198,17 +203,20 @@ describe('force:user:create', () => { | |
]) | ||
.it('default create creates user exactly from DefaultUserFields', (ctx) => { | ||
const expected = { | ||
alias: 'testAlias', | ||
email: username, | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
orgId: 'abc123', | ||
profileId: '00e2D000000bNexWWR', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
permissionSetAssignments: [], | ||
fields: { | ||
alias: 'testAlias', | ||
email: username, | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
profileId: '00e2D000000bNexWWR', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
|
@@ -235,20 +243,22 @@ describe('force:user:create', () => { | |
// we set generatepassword=false in the varargs, in the definitionfile we have generatepassword=true, so we SHOULD NOT generate a password | ||
.it('will merge fields from the cli args, and the definitionfile correctly, preferring cli args', (ctx) => { | ||
const expected = { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
orgId: 'abc123', | ||
permsets: ['test1', 'test2'], | ||
profileId: '00e2D000000bNexWWR', | ||
generatePassword: false, | ||
generatepassword: 'false', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
permissionSetAssignments: ['test1', 'test2'], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
profileId: '00e2D000000bNexWWR', | ||
generatePassword: false, | ||
generatepassword: 'false', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
|
@@ -279,21 +289,24 @@ describe('force:user:create', () => { | |
'will merge fields from the cli args, and the definitionfile correctly, preferring cli args, cli args > file > default', | ||
(ctx) => { | ||
const expected = { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
generatePassword: false, | ||
generatepassword: 'false', | ||
profileName: "'Chatter Free User'", | ||
orgId: 'abc123', | ||
// note the new profileId 12345678 -> Chatter Free User from var args | ||
profileId: '12345678', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
permissionSetAssignments: [], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailEncodingKey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languageLocaleKey: 'en_US', | ||
lastName: 'User', | ||
localeSidKey: 'en_US', | ||
generatePassword: false, | ||
generatepassword: 'false', | ||
profileName: "'Chatter Free User'", | ||
// note the new profileId 12345678 -> Chatter Free User from var args | ||
profileId: '12345678', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
|