Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit d59b2a8

Browse files
authored
Remove test credentials from all test (#659)
1 parent b44dcfe commit d59b2a8

5 files changed

+234
-642
lines changed

Tests/PSGetFindModule.Tests.ps1

-56
Original file line numberDiff line numberDiff line change
@@ -582,59 +582,3 @@ Describe PowerShell.PSGet.FindModuleTests.P2 -Tags 'P2', 'OuterLoop' {
582582
$i = $i + 1
583583
}
584584
}
585-
586-
587-
Describe "Azure Artifacts Credential Provider Integration" -Tags 'BVT' {
588-
589-
BeforeAll {
590-
$repoName = "OneGetTestPrivateFeed"
591-
# This pkg source is an Azure DevOps private feed
592-
$testLocation = "https://pkgs.dev.azure.com/onegettest/_packaging/onegettest/nuget/v2";
593-
$username = "[email protected]"
594-
$PAT = "qo2xvzdnfi2mlcq3eq2jkoxup576kt4gnngcicqhup6bbix6sila"
595-
# see https://github.com/Microsoft/artifacts-credprovider#environment-variables for more info on env vars for the credential provider
596-
# The line below is purely for local testing. Make sure to update env vars in AppVeyor and Travis CI as necessary.
597-
$VSS_NUGET_EXTERNAL_FEED_ENDPOINTS = "{'endpointCredentials': [{'endpoint':'$testLocation', 'username':'$username', 'password':'$PAT'}]}"
598-
[System.Environment]::SetEnvironmentVariable("VSS_NUGET_EXTERNAL_FEED_ENDPOINTS", $VSS_NUGET_EXTERNAL_FEED_ENDPOINTS, [System.EnvironmentVariableTarget]::Process)
599-
600-
601-
# Figure out if Visual Studio is installed, and if it is, we'll use the credential provider that's installed there for the first test
602-
$VSinstalledCredProvider = $false;
603-
$programFiles = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ProgramFilesX86);
604-
$vswhereExePath = $programFiles + "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
605-
$fullVSwhereExePath = [System.Environment]::ExpandEnvironmentVariables($vswhereExePath);
606-
# If the env variable exists, check to see if the path itself exists
607-
if (Test-Path ($fullVSwhereExePath)) {
608-
$VSinstalledCredProvider = $true;
609-
}
610-
}
611-
612-
AfterAll {
613-
UnRegister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
614-
}
615-
616-
it "Register-PackageSource using Visual Studio installed credential provider" -Skip:(!$VSinstalledCredProvider) {
617-
Register-PSRepository $repoName -SourceLocation $testLocation
618-
619-
(Get-PSRepository -Name $repoName).Name | should match $repoName
620-
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation
621-
622-
Unregister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
623-
}
624-
625-
it "Register-PackageSource using credential provider" -Skip:(!$IsWindows) {
626-
# Make sure the credential provider is installed (works for Windows, Linux, and Mac)
627-
# If the credential provider is already installed, will receive the message: "The netcore Credential Provider is already in C:\Users\<alias>\.nuget\plugins"
628-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1'))
629-
630-
Register-PSRepository $repoName -SourceLocation $testLocation
631-
632-
(Get-PSRepository -Name $repoName).Name | should match $repoName
633-
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation
634-
}
635-
636-
it "Find-Package using credential provider" -Skip:(!$IsWindows) {
637-
$pkg = Find-Module * -Repository $repoName
638-
$pkg.Count | should -BeGreaterThan 0
639-
}
640-
}

0 commit comments

Comments
 (0)