-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames option for 'spo user get'. Closes #5515
- Loading branch information
1 parent
2617b90
commit e63ce0b
Showing
4 changed files
with
35 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ m365 spo user get [options] | |
: URL of the web to get the user within | ||
|
||
`-i, --id [id]` | ||
: ID of the user to retrieve information for. Use either `email`, `id` or `userName`, but not all. | ||
: ID of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all. | ||
|
||
`--email [email]` | ||
: Email of the user to retrieve information for. Use either `email`, `id` or `userName`, but not all. | ||
: Email of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all. | ||
|
||
`--userName [userName]` | ||
: Login name of the user to retrieve information for. Use either `email`, `id` or `userName`, but not all. | ||
`--loginName [loginName]` | ||
: Login name of the user to retrieve information for. Use either `email`, `id` or `loginName`, but not all. | ||
``` | ||
|
||
<Global /> | ||
|
@@ -38,16 +38,16 @@ Get user by email for a web | |
m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --email [email protected] | ||
``` | ||
|
||
Get user with ID _6_ for a web | ||
Get user by ID for a web | ||
|
||
```sh | ||
m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --id 6 | ||
``` | ||
|
||
Get user with login name 'i:0#.f|membership|[email protected]' for a web | ||
Get user by login name for a web | ||
|
||
```sh | ||
m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --userName "i:0#.f|membership|[email protected]" | ||
m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --loginName "i:0#.f|membership|[email protected]" | ||
``` | ||
|
||
## Response | ||
|
@@ -105,7 +105,7 @@ m365 spo user get --webUrl https://contoso.sharepoint.com/sites/project-x --user | |
<TabItem value="Markdown"> | ||
|
||
```md | ||
# spo user get --webUrl "https://contoso.sharepoint.com" --userName "i:0#.f|membership|[email protected]" | ||
# spo user get --webUrl "https://contoso.sharepoint.com" --loginName "i:0#.f|membership|[email protected]" | ||
|
||
Date: 4/10/2023 | ||
|
||
|
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 |
---|---|---|
|
@@ -166,7 +166,7 @@ describe(commands.USER_GET, () => { | |
})); | ||
}); | ||
|
||
it('retrieves user by userName with output option json', async () => { | ||
it('retrieves user by loginName with output option json', async () => { | ||
sinon.stub(request, 'get').callsFake(async (opts) => { | ||
if ((opts.url as string).indexOf('/_api/web/siteusers/GetByLoginName') > -1) { | ||
return { | ||
|
@@ -194,7 +194,7 @@ describe(commands.USER_GET, () => { | |
output: 'json', | ||
debug: true, | ||
webUrl: 'https://contoso.sharepoint.com', | ||
userName: "i:0#.f|membership|[email protected]" | ||
loginName: "i:0#.f|membership|[email protected]" | ||
} | ||
}); | ||
assert(loggerLogSpy.calledWith({ | ||
|
@@ -223,7 +223,7 @@ describe(commands.USER_GET, () => { | |
await assert.rejects(command.action(logger, { | ||
options: { | ||
webUrl: 'https://contoso.sharepoint.com', | ||
userName: "i:0#.f|membership|[email protected]" | ||
loginName: "i:0#.f|membership|[email protected]" | ||
} | ||
} as any), new CommandError('An error has occurred')); | ||
}); | ||
|
@@ -244,7 +244,7 @@ describe(commands.USER_GET, () => { | |
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
it('fails validation if id or email or userName options are not passed', async () => { | ||
it('fails validation if id or email or loginName options are not passed', async () => { | ||
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => { | ||
if (settingName === settingsNames.prompt) { | ||
return false; | ||
|
@@ -257,7 +257,7 @@ describe(commands.USER_GET, () => { | |
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
it('fails validation if id, email and userName options are passed (multiple options)', async () => { | ||
it('fails validation if id, email and loginName options are passed (multiple options)', async () => { | ||
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => { | ||
if (settingName === settingsNames.prompt) { | ||
return false; | ||
|
@@ -266,7 +266,7 @@ describe(commands.USER_GET, () => { | |
return defaultValue; | ||
}); | ||
|
||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', id: 1, email: "[email protected]", userName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', id: 1, email: "[email protected]", loginName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
|
@@ -283,7 +283,7 @@ describe(commands.USER_GET, () => { | |
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
it('fails validation if id and userName options are passed (multiple options)', async () => { | ||
it('fails validation if id and loginName options are passed (multiple options)', async () => { | ||
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => { | ||
if (settingName === settingsNames.prompt) { | ||
return false; | ||
|
@@ -292,11 +292,11 @@ describe(commands.USER_GET, () => { | |
return defaultValue; | ||
}); | ||
|
||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', id: 1, userName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', id: 1, loginName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
it('fails validation if email and userName options are passed (multiple options)', async () => { | ||
it('fails validation if email and loginName options are passed (multiple options)', async () => { | ||
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => { | ||
if (settingName === settingsNames.prompt) { | ||
return false; | ||
|
@@ -305,7 +305,7 @@ describe(commands.USER_GET, () => { | |
return defaultValue; | ||
}); | ||
|
||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', email: "[email protected]", userName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', email: "[email protected]", loginName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
assert.notStrictEqual(actual, true); | ||
}); | ||
|
||
|
@@ -324,8 +324,8 @@ describe(commands.USER_GET, () => { | |
assert.strictEqual(actual, true); | ||
}); | ||
|
||
it('passes validation if the url is valid and userName is passed', async () => { | ||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', userName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
it('passes validation if the url is valid and loginName is passed', async () => { | ||
const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', loginName: "i:0#.f|membership|[email protected]" } }, commandInfo); | ||
assert.strictEqual(actual, true); | ||
}); | ||
}); |
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