Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions test/InstallPSResource.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,7 @@ Describe 'Test Install-PSResource for Module' {
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope CurrentUser
$pkg = Get-Module "TestModule" -ListAvailable
$pkg.Name | Should -Be "TestModule"
$pkg.Path.Contains("/home/") | Should -Be $true
}

# Unix only
# Expected path should be similar to: '/usr/local/share/powershell/Modules'
It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) {
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers
$pkg = Get-Module "TestModule" -ListAvailable
$pkg.Name | Should -Be "TestModule"
$pkg.Path.Contains("/usr/") | Should -Be $true
$pkg.Path.Contains("$env:HOME/.local") | Should -Be $true
}

# Unix only
Expand All @@ -172,7 +163,7 @@ Describe 'Test Install-PSResource for Module' {
Install-PSResource -Name "TestModule" -Repository $TestGalleryName
$pkg = Get-Module "TestModule" -ListAvailable
$pkg.Name | Should -Be "TestModule"
$pkg.Path.Contains("/home/") | Should -Be $true
$pkg.Path.Contains("$env:HOME/.local") | Should -Be $true
}

It "Should not install resource that is already installed" {
Expand Down Expand Up @@ -235,8 +226,36 @@ Describe 'Test Install-PSResource for Module' {
$pkg | Should -Not -BeNullOrEmpty
$pkg.Name | Should -Be $publishModuleName
}
}

<# Temporarily commented until -Tag is implemented for this Describe block
Describe 'Test Install-PSResource for interactive and root user scenarios' {

BeforeAll{
$TestGalleryName = Get-PoshTestGalleryName
$PSGalleryName = Get-PSGalleryName
$NuGetGalleryName = Get-NuGetGalleryName
Get-NewPSResourceRepositoryFile
Register-LocalRepos
}

AfterEach {
Uninstall-PSResource "TestModule", "testModuleWithlicense" -Force -ErrorAction SilentlyContinue
}

AfterAll {
Get-RevertPSResourceRepositoryFile
}

# Unix only manual test
# Expected path should be similar to: '/usr/local/share/powershell/Modules'
It "Install resource under AllUsers scope - Unix only" -Skip:(Get-IsWindows) {
Install-PSResource -Name "TestModule" -Repository $TestGalleryName -Scope AllUsers
$pkg = Get-Module "TestModule" -ListAvailable
$pkg.Name | Should -Be "TestModule"
$pkg.Path.Contains("/usr/") | Should -Be $true
}

<#
# This needs to be manually tested due to prompt
It "Install resource that requires accept license without -AcceptLicense flag" {
Install-PSResource -Name "testModuleWithlicense" -Repository $TestGalleryName
Expand All @@ -256,5 +275,5 @@ Describe 'Test Install-PSResource for Module' {

Set-PSResourceRepository PoshTestGallery -Trusted
}
#>
}
#>