Skip to content

Commit

Permalink
Added additional tests for new parameter 🌏
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapbrasser committed Dec 21, 2020
1 parent 8e5e078 commit 5bc6ae2
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions Tests/Invoke-RubrikRestCall.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ Describe -Name 'Public/Invoke-RubrikRestCall' -Tag 'Public', 'Invoke-RubrikRestC
Mock -CommandName Submit-Request -Verifiable -ModuleName 'Rubrik' -MockWith {
@{
'total' = '3'
'data' = @{
'Name' = 'VM1'
'ID' = 'VirtualMachine:11111'
'powerStatus' = 'poweredOn'
},
@{
'Name' = 'VM2'
'ID' = 'VirtualMachine:22222'
'powerStatus' = 'poweredOn'
},
@{
'Name' = 'VM3'
'ID' = 'VirtualMachine:33333'
'powerStatus' = 'poweredOff'
}
'data' = @{
'Name' = 'VM1'
'ID' = 'VirtualMachine:11111'
'powerStatus' = 'poweredOn'
},
@{
'Name' = 'VM2'
'ID' = 'VirtualMachine:22222'
'powerStatus' = 'poweredOn'
},
@{
'Name' = 'VM3'
'ID' = 'VirtualMachine:33333'
'powerStatus' = 'poweredOff'
}
}
}

Expand All @@ -56,7 +56,7 @@ Describe -Name 'Public/Invoke-RubrikRestCall' -Tag 'Public', 'Invoke-RubrikRestC
Should -Throw "Cannot validate argument on parameter 'Endpoint'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again."
}
It -Name 'ValidateSet - Method' -Test {
{ Invoke-RubrikRestCall -Endpoint 'vmware/vm' -Method "non-existant" } |
{ Invoke-RubrikRestCall -Endpoint 'vmware/vm' -Method "non-existent" } |
Should -Throw "Cannot validate argument on parameter 'Method'."
}
It -Name 'Query cannot be null or empty' -Test {
Expand All @@ -66,6 +66,10 @@ Describe -Name 'Public/Invoke-RubrikRestCall' -Tag 'Public', 'Invoke-RubrikRestC
It -Name 'Body cannot be null or empty' -Test {
{ Invoke-RubrikRestCall -Endpoint 'vmware/vm' -Method "POST" -Body $null } |
Should -Throw "Cannot validate argument on parameter 'Body'."
}
}
It -Name 'uri cannot be null or empty' -Test {
{ Invoke-RubrikRestCall -Endpoint 'vmware/vm' -Method "POST" -uri $null } |
Should -Throw "Cannot validate argument on parameter 'uri'."
}
}
}

0 comments on commit 5bc6ae2

Please sign in to comment.