SnipeitPS/Tests/Connect-SnipeitPS.Tests.ps1

24 lines
977 B
PowerShell
Raw Normal View History

2021-09-06 07:53:51 +03:00
BeforeEach {
2021-09-06 07:29:20 +03:00
$script:SnipeitDev = 'https://develop.snipeitapp.com/'
$script:SnipeitKey = 'UqddVx6SDb3HLw1Pmw1wGGYHA6w8wWQAiS9kg2xMcz5i75HOULaN3miqYvcPCvHpI2CBfuvdplI8QNm_XzFPmoQRu_5kR8knzla4'
2021-09-06 07:59:49 +03:00
$script:SnipeitSecKey = ConvertTo-SecureString -String $script:SnipeitKey -AsPlainText -Force
$script:SnipeSiteCred = New-Object -Type PSCredential -Argumentlist $script:SnipeitDev,$script:SnipeitSecKey
2021-09-06 07:29:20 +03:00
}
2021-09-06 06:08:57 +03:00
Describe 'Connect-SnipeitPS' {
2021-09-06 06:18:31 +03:00
Context "Connections" {
2021-09-06 06:08:57 +03:00
2021-09-06 06:18:31 +03:00
It 'Should connect to api with url and api key' {
2021-09-06 06:22:59 +03:00
Connect-SnipeitPS -url $script:SnipeitDev -apiKey $script:SnipeitKey | Should -Not Throw
2021-09-06 06:18:31 +03:00
}
2021-09-06 06:08:57 +03:00
2021-09-06 06:18:31 +03:00
It 'Should connect to api with url and secureapi key' {
2021-09-06 06:22:59 +03:00
Connect-SnipeitPS -url $script:SnipeitDev -secureApiKey $script:SnipeitSecKey | Should -Not Throw
2021-09-06 06:18:31 +03:00
}
2021-09-06 06:08:57 +03:00
2021-09-06 06:18:31 +03:00
It 'Should connect to api with siteCred' {
2021-09-06 06:22:59 +03:00
Connect-SnipeitPS -siteCred $script:SnipeSiteCred | Should -Not Throw
2021-09-06 06:18:31 +03:00
}
2021-09-06 06:08:57 +03:00
}
}