Update Connect-ZertoServer tests
This commit is contained in:
@@ -1,25 +1,39 @@
|
|||||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
|
$moduleFileName = "ZertoApiWrapper.psm1"
|
||||||
. ../$sut
|
$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper'
|
||||||
. ../Invoke-ZertoRestRequest.ps1
|
$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.'
|
||||||
. ../Disconnect-ZertoServer.ps1
|
$modulePath = $filePath -replace "Public", ""
|
||||||
|
Import-Module $modulePath/$moduleFileName -Force
|
||||||
|
|
||||||
$credential = Import-Clixml -Path C:\ZertoScripts\Creds.xml
|
$userName = "zerto\build"
|
||||||
$zertoServer = "192.168.222.20"
|
$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force
|
||||||
$zertoPort = "9669"
|
$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password)
|
||||||
|
|
||||||
|
# $credential = Import-Clixml -Path C:\ZertoScripts\Creds.xml
|
||||||
|
$zertoServer = "192.168.1.100"
|
||||||
|
$zertoPort = "7669"
|
||||||
|
|
||||||
Describe "Connect-ZertoServer" {
|
Describe "Connect-ZertoServer" {
|
||||||
it "should exist" {
|
it "should exist" {
|
||||||
"../Invoke-ZertoRestRequest.ps1" | should exist
|
"$filePath\$fileName" | should exist
|
||||||
}
|
}
|
||||||
it "has a function called Connect-ZertoServer" {
|
it "has a function called Connect-ZertoServer" {
|
||||||
get-command Connect-ZertoServer | should be $true
|
get-command Connect-ZertoServer | should be $true
|
||||||
}
|
}
|
||||||
Connect-ZertoServer -zertoServer $zertoServer -zertoPort $zertoPort -credential $credential
|
$headers = Connect-ZertoServer -zertoServer $zertoServer -zertoPort $zertoPort -credential $credential
|
||||||
it "set an Env variable called zertoConnectionInformation" {
|
it "returns a Hashtable with 2 keys" {
|
||||||
Test-Path Env:/zertoConnectionInformation | should be $true
|
$headers.keys.count | should be 2
|
||||||
}
|
}
|
||||||
it "set an Env variable called zertoAuthorizationHeaders" {
|
it "return value has a key called 'x-zerto-session'" {
|
||||||
Test-Path Env:/zertoAuthorizationHeaders | should be $true
|
$headers.ContainsKey('x-zerto-session') | should be $true
|
||||||
|
}
|
||||||
|
it "return key 'x-zerto-session' value should be a string" {
|
||||||
|
$headers['x-zerto-session'].gettype().name | should be "String"
|
||||||
|
}
|
||||||
|
it "return value has a key called 'accept'" {
|
||||||
|
$headers.ContainsKey('accept') | should be $true
|
||||||
|
}
|
||||||
|
it "return key 'accept' value should be 'application/json'" {
|
||||||
|
$headers['accept'] | should be 'application/json'
|
||||||
}
|
}
|
||||||
Disconnect-ZertoServer
|
Disconnect-ZertoServer
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user