diff --git a/tests/pester-tests/commands/choco-push.Tests.ps1 b/tests/pester-tests/commands/choco-push.Tests.ps1 index 63a2a002f..25475bf5a 100644 --- a/tests/pester-tests/commands/choco-push.Tests.ps1 +++ b/tests/pester-tests/commands/choco-push.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module helpers/common-helpers +Import-Module helpers/common-helpers # These are skipped in the Proxy Test environment because they push to a port outside of 8443 which is not allowed by our proxy. Describe "choco push" -Tag Chocolatey, PushCommand, ProxySkip -Skip:($null -eq $env:API_KEY -or $null -eq $env:PUSH_REPO) { @@ -152,6 +152,9 @@ Describe 'choco push nuget <_> repository' -Tag Chocolatey, PushCommand -Skip:($ if ($UseConfig) { $null = Invoke-Choco apikey add --source $RepositoryToUse$RepositoryEndpoint --api-key $ApiKey + # Add the Nuget source so that the push doesn't prompt for credentials. + # See https://github.com/chocolatey/choco/issues/2026#issuecomment-2423828013 + $null = Invoke-Choco source add --name temporary-nuget --source $RepositoryToUse$RepositoryEndpoint --user $env:NUGET_SOURCE_USERNAME --password $env:NUGET_SOURCE_PASSWORD # Ensure the key is null (should always be, but scoping can be wonky) $KeyParameter = $null } else {