This commit is contained in:
parent
025f18725b
commit
d19278c99d
@ -11,10 +11,10 @@
|
||||
param ()
|
||||
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
$ManifestFile = (Get-Item -Path './src/*.psd1').FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$PrivateFunctions = (Get-ChildItem -Path './src/Private/*.ps1' | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
@ -23,25 +23,25 @@ BeforeAll {
|
||||
}
|
||||
|
||||
# Backup existing credential stores
|
||||
$VerbosePreference = "Continue"
|
||||
Write-Verbose "Backup private Credential Store..."
|
||||
$VerbosePreference = 'Continue'
|
||||
Write-Verbose -Message 'Backup private Credential Store...'
|
||||
$CSPath = Get-DefaultCredentialStorePath
|
||||
$BackupFile = "{0}.back" -f $CSPath
|
||||
$BackupFile = '{0}.back' -f $CSPath
|
||||
if (Test-Path -Path $CSPath) {
|
||||
Move-Item -Path $CSPath -Destination $BackupFile
|
||||
}
|
||||
Write-Verbose "Backup shared CredentialStore..."
|
||||
Write-Verbose -Message 'Backup shared CredentialStore...'
|
||||
$CSShared = Get-DefaultCredentialStorePath -Shared
|
||||
$BackupSharedFile = "{0}.back" -f $CSShared
|
||||
$BackupSharedFile = '{0}.back' -f $CSShared
|
||||
if (Test-Path -Path $CSShared) {
|
||||
Move-Item -Path $CSShared -Destination $BackupSharedFile
|
||||
}
|
||||
Write-Verbose "Remove old CredentialStore in Temp dir"
|
||||
Write-Verbose -Message 'Remove old CredentialStore in Temp dir'
|
||||
$CSTemp = Join-Path -Path (Get-TempDir) -ChildPath '/CredentialStore.json'
|
||||
if (Test-Path -Path $CSTemp) {
|
||||
Remove-Item -Path $CSTemp
|
||||
}
|
||||
$VerbosePreference = "SilentlyContinue"
|
||||
$VerbosePreference = 'SilentlyContinue'
|
||||
}
|
||||
|
||||
Describe 'New-CredentialStoreItem' {
|
||||
@ -109,8 +109,8 @@ Describe 'New-CredentialStoreItem' {
|
||||
|
||||
AfterAll {
|
||||
# Cleanup test stores and restore existing ones.
|
||||
$VerbosePreference = "Continue"
|
||||
Write-Verbose "Restoring private CredentialStore"
|
||||
$VerbosePreference = 'Continue'
|
||||
Write-Verbose -Message 'Restoring private CredentialStore'
|
||||
If (Test-Path -Path $BackupFile) {
|
||||
If (Test-Path -Path $CSPath) {
|
||||
Remove-Item -Path $CSPath
|
||||
@ -118,13 +118,13 @@ AfterAll {
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Restoring shared CredentialStore"
|
||||
Write-Verbose -Message 'Restoring shared CredentialStore'
|
||||
If (Test-Path -Path $BackupSharedFile) {
|
||||
If (Test-Path -Path $CSShared) {
|
||||
Remove-Item -Path $CSShared
|
||||
Move-Item -Path $BackupSharedFile -Destination $CSShared
|
||||
}
|
||||
}
|
||||
$VerbosePreference = "SilentlyContinue"
|
||||
$VerbosePreference = 'SilentlyContinue'
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user