@@ -346,6 +346,22 @@ Describe "Test Publish-PSResource" -tags 'CI' {
346346 $results [0 ].Version | Should - Be $correctVersion
347347 }
348348
349+ It " Publish a package should always require authentication" {
350+ $version = " 15.0.0"
351+ New-ModuleManifest - Path (Join-Path - Path $script :PublishModuleBase - ChildPath " $script :PublishModuleName .psd1" ) - ModuleVersion $version - Description " $script :PublishModuleName module"
352+
353+ Publish-PSResource - Path $script :PublishModuleBase - Repository $ACRRepoName - InformationVariable RegistryAuthenticated
354+
355+ $results = Find-PSResource - Name $script :PublishModuleName - Repository $ACRRepoName
356+ $results | Should -Not - BeNullOrEmpty
357+ $results [0 ].Name | Should - Be $script :PublishModuleName
358+ $results [0 ].Version | Should - Be $version
359+
360+ Write-Verbose - Verbose " obj: $RegistryAuthenticated "
361+ $RegistryAuthenticated [0 ].Tags | Should - Be " PSRGContainerRegistryUnauthenticatedCheck"
362+ $RegistryAuthenticated [0 ].MessageData | Should - Be " Value of isRepositoryUnauthenticated: False"
363+ }
364+
349365 It " Publish a script" {
350366 $scriptVersion = " 1.0.0"
351367 $params = @ {
@@ -568,21 +584,6 @@ Describe "Test Publish-PSResource" -tags 'CI' {
568584 $results [0 ].Name | Should - Be $packageName
569585 $results [0 ].Version | Should - Be $version
570586 }
571-
572- It " Publish a package should always require authentication" {
573- $version = " 15.0.0"
574- New-ModuleManifest - Path (Join-Path - Path $script :PublishModuleBase - ChildPath " $script :PublishModuleName .psd1" ) - ModuleVersion $version - Description " $script :PublishModuleName module"
575-
576- Publish-PSResource - Path $script :PublishModuleBase - Repository $ACRRepoName - InformationVariable RegistryAuthenticated
577-
578- $results = Find-PSResource - Name $script :PublishModuleName - Repository $ACRRepoName
579- $results | Should -Not - BeNullOrEmpty
580- $results [0 ].Name | Should - Be $script :PublishModuleName
581- $results [0 ].Version | Should - Be $version
582-
583- $RegistryAuthenticated [0 ].MessageData | Should - Be " Value of isRepositoryUnauthenticated: False"
584- $RegistryAuthenticated [0 ].Tags | Should - Be " PSRGContainerRegistryUnauthenticatedCheck"
585- }
586587}
587588
588589Describe ' Test Publish-PSResource for MAR Repository' - tags ' CI' {
0 commit comments