Skip to content

Commit f420221

Browse files
committed
Copy Pester updates to stembuild/modules/
1 parent 4226570 commit f420221

File tree

17 files changed

+421
-439
lines changed

17 files changed

+421
-439
lines changed

modules/BOSH.Agent/BOSH.Agent.Tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ BeforeAll {
1212
}
1313
}
1414

15-
1615
Describe "Copy-Agent" {
1716
BeforeEach {
1817
$installDir=(New-TempDir)

modules/BOSH.CFCell/BOSH.CFCell.Tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ Describe "Protect-CFCell" {
6262

6363
Describe "Install-CFFeatures" {
6464
It "restarts computer on Microsoft server 2016 and later" {
65-
6665
Mock -ModuleName BOSH.CFCell Install-CFFeatures2012 { }
6766
Mock -ModuleName BOSH.CFCell Install-CFFeatures2016 { }
6867
Mock -ModuleName BOSH.CFCell Write-Error { }
@@ -83,7 +82,6 @@ Describe "Install-CFFeatures2016" {
8382
Mock Uninstall-WindowsFeature { }
8483
Mock -ModuleName BOSH.CFCell Uninstall-WindowsFeature { }
8584
Mock -ModuleName BOSH.CFCell Set-Service { }
86-
# Mock Set-Service { }
8785
Mock -ModuleName BOSH.CFCell Restart-Computer { }
8886
Mock -ModuleName BOSH.CFCell Get-OSVersionString { "10.0.1803" }
8987
}

modules/BOSH.CFCell/BOSH.CFCell.psm1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# function Get-OSVersionStringg {
2-
# return [System.Environment]::OSVersion.Version.ToString()
3-
# }
4-
5-
<#
1+
<#
62
.Synopsis
73
Install CloudFoundry Cell components for either 2012R2 or 2016
84
.Description

modules/BOSH.Registry/BOSH.Registry.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Describe "BOSH.Registry" {
77
$newItemReturn = [pscustomobject]@{"NewPath" = "HKCU:/Path/created";}
88
Mock -ModuleName BOSH.Registry New-Item { $newItemReturn }
99
# reset for our -parameterfilter mock
10-
# Mock -ModuleName BOSH.Registry New-Item { $newItemReturn } -ParameterFilter { $PSBoundParameters['ErrorAction'] -eq "Stop" }
10+
#Mock -ModuleName BOSH.Registry New-Item { $newItemReturn } -ParameterFilter { $PSBoundParameters['ErrorAction'] -eq "Stop" }
1111
}
1212

1313
It "Set-InternetExplorerRegistries applies internet explorer settings when valid policy files are generated" {

modules/BOSH.SSH/BOSH.SSH.Tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
BeforeAll {
22
Import-Module ./BOSH.SSH.psm1
33

4-
function Get-FileEncoding
5-
{
4+
function Get-FileEncoding {
65
[CmdletBinding()]
76
param (
87
[Alias("PSPath")]
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
Remove-Module -Name BOSH.Account -ErrorAction Ignore
2-
Import-Module ./BOSH.Account.psm1
1+
BeforeAll {
2+
Remove-Module -Name BOSH.Account -ErrorAction Ignore
3+
Import-Module ./BOSH.Account.psm1
34

4-
Remove-Module -Name BOSH.Utils -ErrorAction Ignore
5-
Import-Module ../BOSH.Utils/BOSH.Utils.psm1
5+
Remove-Module -Name BOSH.Utils -ErrorAction Ignore
6+
Import-Module ../BOSH.Utils/BOSH.Utils.psm1
7+
}
68

79
Describe "Account" {
8-
910
Context "when username is not provided" {
1011
It "throws" {
11-
{ Add-Account } | Should Throw "Provide a user name"
12+
{ Add-Account } | Should -Throw "Provide a user name"
1213
}
1314
}
1415

1516
Context "when password is not provided" {
1617
It "throws" {
17-
{ Add-Account -User hello } | Should Throw "Provide a password"
18+
{ Add-Account -User hello } | Should -Throw "Provide a password"
1819
}
1920
}
2021

2122
Context "when the username and password are valid" {
22-
$timestamp=(get-date -UFormat "%s" -Millisecond 0)
23-
$user = "TestUser_$timestamp"
24-
$password = "Password123!"
23+
BeforeAll {
24+
$timestamp=(get-date -UFormat "%s" -Millisecond 0)
25+
$user = "TestUser_$timestamp"
26+
$password = "Password123!"
27+
}
2528

2629
BeforeEach {
2730
$userExists = !!(Get-LocalUser | Where {$_.Name -eq $user})
@@ -34,14 +37,11 @@ Describe "Account" {
3437
Add-Account -User $user -Password $password
3538
mkdir "C:\Users\$user" -ErrorAction Ignore
3639
$adsi = [ADSI]"WinNT://$env:COMPUTERNAME"
37-
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $user }
38-
$existing | Should Not Be $null
40+
$existing = $adsi.Children | Where-Object {$_.SchemaClassName -eq 'user' -and $_.Name -eq $user }
41+
$existing | Should -Not -Be $null
3942
Remove-Account -User $user
40-
$existing = $adsi.Children | where {$_.SchemaClassName -eq 'user' -and $_.Name -eq $user }
41-
$existing | Should Be $null
43+
$existing = $adsi.Children | Where-Object {$_.SchemaClassName -eq 'user' -and $_.Name -eq $user }
44+
$existing | Should -Be $null
4245
}
4346
}
4447
}
45-
46-
Remove-Module -Name BOSH.Account -ErrorAction Ignore
47-
Remove-Module -Name BOSH.Utils -ErrorAction Ignore

0 commit comments

Comments
 (0)