Update comments for Export-Alias Pester unit test
This commit is contained in:
parent
04f3936b6b
commit
108bcbf860
|
@ -1,7 +1,7 @@
|
||||||
Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
||||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
||||||
$testAliases = "TestAliases"
|
$testAliases = "TestAliases"
|
||||||
$fulltestpath = Join-Path -Path $($testAliasDirectory) -ChildPath $($testAliases)
|
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
|
||||||
|
|
||||||
BeforeEach {
|
BeforeEach {
|
||||||
New-Item -Path $testAliasDirectory -ItemType Directory -Force
|
New-Item -Path $testAliasDirectory -ItemType Directory -Force
|
||||||
|
@ -90,25 +90,17 @@ Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
||||||
$fulltestpath| Should ContainExactly '"abcd02","efgh02","","None"'
|
$fulltestpath| Should ContainExactly '"abcd02","efgh02","","None"'
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Export-Alias for Force ReadOnly Test for linux" -Skip:$IsWindows {
|
It "Export-Alias for Force ReadOnly Test" {
|
||||||
Export-Alias $fulltestpath abcd01
|
Export-Alias $fulltestpath abcd01
|
||||||
chmod 444 $fulltestpath
|
if ( $IsWindows )
|
||||||
try{
|
{
|
||||||
Export-Alias $fulltestpath abcd02
|
attrib +r $fulltestpath
|
||||||
}
|
}
|
||||||
catch{
|
else
|
||||||
$_.FullyQualifiedErrorId | Should be "FileOpenFailure,Microsoft.PowerShell.Commands.ExportAliasCommand"
|
{
|
||||||
|
chmod 444 $fulltestpath
|
||||||
}
|
}
|
||||||
Export-Alias $fulltestpath abcd03 -force
|
|
||||||
$fulltestpath| Should Not ContainExactly '"abcd01","efgh01","","None"'
|
|
||||||
$fulltestpath| Should Not ContainExactly '"abcd02","efgh02","","None"'
|
|
||||||
$fulltestpath| Should ContainExactly '"abcd03","efgh03","","None"'
|
|
||||||
chmod 777 $fulltestpath
|
|
||||||
}
|
|
||||||
|
|
||||||
It "Export-Alias for Force ReadOnly Test for windows" -Skip:($IsLinux -Or $IsOSX) {
|
|
||||||
Export-Alias $fulltestpath abcd01
|
|
||||||
attrib +r $fulltestpath
|
|
||||||
try{
|
try{
|
||||||
Export-Alias $fulltestpath abcd02
|
Export-Alias $fulltestpath abcd02
|
||||||
}
|
}
|
||||||
|
@ -119,14 +111,23 @@ Describe "Export-Alias DRT Unit Tests" -Tags DRT{
|
||||||
$fulltestpath| Should Not ContainExactly '"abcd01","efgh01","","None"'
|
$fulltestpath| Should Not ContainExactly '"abcd01","efgh01","","None"'
|
||||||
$fulltestpath| Should Not ContainExactly '"abcd02","efgh02","","None"'
|
$fulltestpath| Should Not ContainExactly '"abcd02","efgh02","","None"'
|
||||||
$fulltestpath| Should ContainExactly '"abcd03","efgh03","","None"'
|
$fulltestpath| Should ContainExactly '"abcd03","efgh03","","None"'
|
||||||
attrib -r $fulltestpath
|
|
||||||
|
if ( $IsWindows )
|
||||||
|
{
|
||||||
|
attrib -r $fulltestpath
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chmod 777 $fulltestpath
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "Export-Alias" {
|
Describe "Export-Alias" {
|
||||||
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
$testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory
|
||||||
$testAliases = "TestAliases"
|
$testAliases = "TestAliases"
|
||||||
$fulltestpath = Join-Path -Path $($testAliasDirectory) -ChildPath $($testAliases)
|
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
|
||||||
|
|
||||||
BeforeEach {
|
BeforeEach {
|
||||||
New-Item -Path $testAliasDirectory -ItemType Directory -Force
|
New-Item -Path $testAliasDirectory -ItemType Directory -Force
|
||||||
|
@ -144,7 +145,7 @@ Describe "Export-Alias" {
|
||||||
Test-Path $fulltestpath | Should Be $true
|
Test-Path $fulltestpath | Should Be $true
|
||||||
|
|
||||||
$actual = Get-Content $fulltestpath | Sort
|
$actual = Get-Content $fulltestpath | Sort
|
||||||
$expected = $(Get-Command -CommandType Alias)
|
$expected = Get-Command -CommandType Alias
|
||||||
|
|
||||||
for ( $i=0; $i -lt $expected.Length; $i++)
|
for ( $i=0; $i -lt $expected.Length; $i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue