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