-
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.
Merge pull request #32 from Readify/fix-set-user-mandatory
Correctly require `Name` rather than `Email` which is optional.
- Loading branch information
Showing
2 changed files
with
11 additions
and
11 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 |
---|---|---|
|
@@ -296,36 +296,36 @@ Describe 'Users Routes' { | |
|
||
$context.User.role = 'admin' | ||
|
||
{ Set-User -Context $context -Email '[email protected]' -Confirm:$false } | Should -Not -Throw | ||
{ Set-User -Context $context -Name 'Bob Johnson' -Confirm:$false } | Should -Not -Throw | ||
Assert-MockCalled Invoke-RestMethod -Exactly 1 -ParameterFilter { $Method -eq 'Post' -and $Uri -match '/api/v2/users/create_or_update\.json' } -Scope It | ||
} | ||
|
||
It 'Does not allow end users to call' { | ||
$context.User.role = 'end-user' | ||
|
||
{ Set-User -Context $context -Email '[email protected]' -Confirm:$false } | Should -Throw 'Authenticated user must have role' | ||
{ Set-User -Context $context -Name 'Bob Johnson' -Confirm:$false } | Should -Throw 'Authenticated user must have role' | ||
} | ||
|
||
It 'Allows agents to call' { | ||
$context.User.role = 'agent' | ||
|
||
{ Set-User -Context $context -Email '[email protected]' -Confirm:$false } | Should -Not -Throw | ||
{ Set-User -Context $context -Name 'Bob Johnson' -Confirm:$false } | Should -Not -Throw | ||
} | ||
|
||
It 'Allows admins to call' { | ||
$context.User.role = 'admin' | ||
|
||
{ Set-User -Context $context -Email '[email protected]' -Confirm:$false } | Should -Not -Throw | ||
{ Set-User -Context $context -Name 'Bob Johnson' -Confirm:$false } | Should -Not -Throw | ||
} | ||
|
||
} | ||
|
||
Context 'Create Or Update Many Users' { | ||
|
||
$users = @( | ||
[PSCustomObject]@{ email = '[email protected]' } | ||
[PSCustomObject]@{ email = '[email protected]' } | ||
[PSCustomObject]@{ email = '[email protected]' } | ||
[PSCustomObject]@{ name = 'Rob' } | ||
[PSCustomObject]@{ name = 'Ross' } | ||
[PSCustomObject]@{ name = 'Russel' } | ||
) | ||
|
||
It 'Matches the endpoint' { | ||
|