Migrates to Pester5+ tests #59
@ -1,4 +1,17 @@
|
|||||||
$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName'
|
BeforeAll {
|
||||||
|
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||||
|
Import-Module $ManifestFile -Force
|
||||||
|
|
||||||
|
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||||
|
$_.BaseName -notmatch '.Tests'
|
||||||
|
}
|
||||||
|
).FullName
|
||||||
|
foreach ( $func in $PrivateFunctions) {
|
||||||
|
. $func
|
||||||
|
}
|
||||||
|
|
||||||
|
$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName'
|
||||||
|
}
|
||||||
|
|
||||||
Describe "Get-CredentialStore" {
|
Describe "Get-CredentialStore" {
|
||||||
Context "Basic logic tests" {
|
Context "Basic logic tests" {
|
@ -1,23 +1,35 @@
|
|||||||
# Backup existing credential stores
|
BeforeAll {
|
||||||
$VerbosePreference = "Continue"
|
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||||
Write-Verbose "Backup private Credential Store..."
|
Import-Module $ManifestFile -Force
|
||||||
$CSPath = Get-DefaultCredentialStorePath
|
|
||||||
$BackupFile = "{0}.back" -f $CSPath
|
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||||
If (Test-Path -Path $CSPath) {
|
$_.BaseName -notmatch '.Tests'
|
||||||
|
}
|
||||||
|
).FullName
|
||||||
|
foreach ( $func in $PrivateFunctions) {
|
||||||
|
. $func
|
||||||
|
}
|
||||||
|
# Backup existing credential stores
|
||||||
|
$VerbosePreference = "Continue"
|
||||||
|
Write-Verbose "Backup private Credential Store..."
|
||||||
|
$CSPath = Get-DefaultCredentialStorePath
|
||||||
|
$BackupFile = "{0}.back" -f $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 "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 "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-CredentialStore" {
|
Describe "New-CredentialStore" {
|
||||||
Context "Private CS tests" {
|
Context "Private CS tests" {
|
@ -1,4 +1,17 @@
|
|||||||
$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName'
|
BeforeAll {
|
||||||
|
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||||
|
Import-Module $ManifestFile -Force
|
||||||
|
|
||||||
|
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||||
|
$_.BaseName -notmatch '.Tests'
|
||||||
|
}
|
||||||
|
).FullName
|
||||||
|
foreach ( $func in $PrivateFunctions) {
|
||||||
|
. $func
|
||||||
|
}
|
||||||
|
|
||||||
|
$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName'
|
||||||
|
}
|
||||||
|
|
||||||
Describe "Test-CredentialStore" {
|
Describe "Test-CredentialStore" {
|
||||||
Context "Basic logic tests" {
|
Context "Basic logic tests" {
|
Loading…
Reference in New Issue
Block a user