Skip to content

Commit 29578c6

Browse files
committed
updated pester tests for CIS cmdlets
1 parent 3c18981 commit 29578c6

5 files changed

+49
-0
lines changed

Pester/Test Get-CISService.Tests.ps1

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<#
2+
Script name: Test Connect-CISService.Tests.ps1
3+
Created on: 04/20/2017
4+
Author: Alan Renouf, @alanrenouf
5+
Description: The purpose of this pester test is to ensure the CIS Service cmdlet works correctly
6+
Dependencies: Pester Module
7+
Example run:
8+
9+
Invoke-Pester -Script @{ Path = '.\Test Get-CISService.ps1' }
10+
11+
#>
12+
13+
Describe "Checking PowerCLI Cmdlets available" {
14+
$cmdletname = "Get-CISService"
15+
It "Checking $cmdletname is available" {
16+
$command = Get-Command $cmdletname
17+
$command | Select Name, Version
18+
$command.Name| Should Be $cmdletname
19+
}
20+
}
21+
22+
Describe "Get-CISService Tests for services" {
23+
24+
It "Checking CIS connection is active" {
25+
$Global:DefaultCISServers[0].isconnected | Should Be $true
26+
}
27+
28+
It "Checking Get-CISService returns services" {
29+
Get-CISService | Should Be $true
30+
}
31+
32+
# Checking some known services which have a Get Method
33+
$servicestocheck = "com.vmware.appliance.system.version", "com.vmware.appliance.health.system"
34+
Foreach ($service in $servicestocheck) {
35+
It "Checking $service get method returns data" {
36+
Get-CisService -Name $service | Should Be $true
37+
(Get-CisService -Name $service).get() | Should Be $true
38+
}
39+
}
40+
41+
# Checking some known services which have a List Method
42+
$servicestocheck = "com.vmware.vcenter.folder", "com.vmware.vcenter.vm"
43+
Foreach ($service in $servicestocheck) {
44+
It "Checking $service list method returns data" {
45+
Get-CisService -Name $service | Should Be $true
46+
(Get-CisService -Name $service).list() | Should Be $true
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)