Skip to content

Commit

Permalink
Fix minor issues on code
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Moreau committed Nov 8, 2019
1 parent 5bb467f commit f353ca1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
15 changes: 9 additions & 6 deletions PowerArubaSW/Public/RADIUS_GROUP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function Get-ArubaSWRadiusGroup {
.EXAMPLE
Get-ArubaSWRadiusGroup -server_group_name PowerArubaSW
This function give you all the informations about the radius servers in the group PowerArubaSW configured on the switch.
#>

Expand Down Expand Up @@ -56,18 +57,19 @@ function Add-ArubaSWRadiusGroup {
.EXAMPLE
Add-ArubaSWRadiusGroup -server_group_name PowerArubaSWGroup -server1 192.0.2.1 -server2 192.0.2.2 -server3 192.0.2.3
Add the group PowerArubaSWGroup with servers.
#>

Param(
[Parameter (Mandatory = $true)]
[string]$server_group_name,
[Parameter (Mandatory = $true)]
[string]$server1,
[string]$ipaddress1,
[Parameter (Mandatory = $false)]
[string]$server2,
[string]$ipaddress2,
[Parameter (Mandatory = $false)]
[string]$server3,
[string]$ipaddress3,
[Parameter (Mandatory=$False)]
[ValidateNotNullOrEmpty()]
[PSObject]$connection=$DefaultArubaSWConnection
Expand All @@ -88,7 +90,7 @@ function Add-ArubaSWRadiusGroup {

$serverip1 | Add-Member -name "version" -MemberType NoteProperty -Value "IAV_IP_V4"

$serverip1 | Add-Member -name "octets" -MemberType NoteProperty -Value $server1
$serverip1 | Add-Member -name "octets" -MemberType NoteProperty -Value $ipaddress1

$servers += $serverip1

Expand All @@ -97,7 +99,7 @@ function Add-ArubaSWRadiusGroup {

$serverip2 | Add-Member -name "version" -MemberType NoteProperty -Value "IAV_IP_V4"

$serverip2 | Add-Member -name "octets" -MemberType NoteProperty -Value $server2
$serverip2 | Add-Member -name "octets" -MemberType NoteProperty -Value $ipaddress2

$servers += $serverip2
}
Expand All @@ -107,7 +109,7 @@ function Add-ArubaSWRadiusGroup {

$serverip3 | Add-Member -name "version" -MemberType NoteProperty -Value "IAV_IP_V4"

$serverip3 | Add-Member -name "octets" -MemberType NoteProperty -Value $server3
$serverip3 | Add-Member -name "octets" -MemberType NoteProperty -Value $ipaddress3

$servers += $serverip3
}
Expand Down Expand Up @@ -138,6 +140,7 @@ function Remove-ArubaSWRadiusGroup {
.EXAMPLE
Remove-ArubaSWRadius -server_group_name PowerArubaSW
Remove the radius server group with name PowerArubaSW.
#>

Expand Down
20 changes: 10 additions & 10 deletions Tests/integration/RADIUS_GROUP.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

. ../common.ps1

Describe "Get-ArubaSWRadiusGroup" {
It "Get-ArubaSWRadiusGroup Does not throw an error" {
Add-ArubaSWRadius -address 192.0.2.1 -shared_secret powerarubasw
Add-ArubaSWRadiusGroup -server_group_name PowerArubaSW -server1 192.0.2.1
{ Get-ArubaSWRadiusGroup -server_group_name PowerArubaSW } | Should Not Throw
Remove-ArubaSWRadiusGroup -server_group_name PowerArubaSW -noconfirm
Remove-ArubaSWRadius -address 192.0.2.1 -noconfirm
}
}

Describe "Add-ArubaSWRadiusGroup" {

BeforeEach {
Expand Down Expand Up @@ -35,16 +45,6 @@ Describe "Add-ArubaSWRadiusGroup" {
}
}

Describe "Get-ArubaSWRadiusGroup" {
It "Get-ArubaSWRadiusGroup Does not throw an error" {
Add-ArubaSWRadius -address 192.0.2.1 -shared_secret powerarubasw
Add-ArubaSWRadiusGroup -server_group_name PowerArubaSW -server1 192.0.2.1
{ Get-ArubaSWRadiusGroup -server_group_name PowerArubaSW } | Should Not Throw
Remove-ArubaSWRadiusGroup -server_group_name PowerArubaSW -noconfirm
Remove-ArubaSWRadius -address 192.0.2.1 -noconfirm
}
}

Describe "Remove-ArubaSWRadiusGroup" {
It "Remove RADIUS group server" {
Add-ArubaSWRadius -address 192.0.2.1 -shared_secret powerarubasw
Expand Down

0 comments on commit f353ca1

Please sign in to comment.