Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Add Connection test suite #59

Merged
merged 1 commit into from
Nov 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Tests/integration/Connection.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright 2018, Alexis La Goutte <alexis.lagoutte at gmail dot com>
#
# SPDX-License-Identifier: Apache-2.0
#
. ../common.ps1

Describe "Connect to a switch (using HTTP)" {
BeforeAll {
#Disconnect "default connection"
Disconnect-ArubaSW -noconfirm
}
It "Connect to a switch (using HTTP) and check global variable" {
Connect-ArubaSW $ipaddress -Username $login -password $mysecpassword -httpOnly -noverbose
$DefaultArubaSWConnection | should Not BeNullOrEmpty
$DefaultArubaSWConnection.server | should be $ipaddress
$DefaultArubaSWConnection.cookie | should Not BeNullOrEmpty
$DefaultArubaSWConnection.port | should be "80"
$DefaultArubaSWConnection.httpOnly | should be $true
$DefaultArubaSWConnection.session | should not BeNullOrEmpty
}
It "Disconnect to a switch (using HTTP) and check global variable" {
Disconnect-ArubaSW -noconfirm
$DefaultArubaSWConnection | should be $null
}
#TODO: Connect using wrong login/password
}

Describe "Connect to a switch (using HTTPS)" {
#TODO Try change port => Need AnyCLI
#TODO Try to check invalid certificat
It "Connect to a switch (using HTTPS) and check global variable" -Skip:($httpOnly) {
Connect-ArubaSW $ipaddress -Username $login -password $mysecpassword -noverbose
$DefaultArubaSWConnection | should Not BeNullOrEmpty
$DefaultArubaSWConnection.server | should be $ipaddress
$DefaultArubaSWConnection.cookie | should Not BeNullOrEmpty
$DefaultArubaSWConnection.port | should be "443"
$DefaultArubaSWConnection.httpOnly | should be $false
$DefaultArubaSWConnection.session | should not BeNullOrEmpty
}
It "Disconnect to a switch (using HTTPS) and check global variable" -Skip:($httpOnly) {
Disconnect-ArubaSW -noconfirm
$DefaultArubaSWConnection | should be $null
}
}