Add an additional acceptance test for the PowerShellGet module (#4531)

* Add an additional acceptance test for the PowerShellGet module

* Removed 'BVT' tag
This commit is contained in:
Manikyam Bavandla 2017-08-10 13:33:25 -07:00 committed by Aditya Patwardhan
parent 384a9fe3fc
commit 0bfee35525

View file

@ -90,7 +90,7 @@ function Initialize
function Remove-InstalledModules
{
Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module -Force
Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | PowerShellGet\Uninstall-Module -Force
}
Describe "PowerShellGet - Module tests" -tags "Feature" {
@ -226,6 +226,38 @@ Describe "PowerShellGet - Script tests (Admin)" -tags @('Feature', 'RequireAdmin
}
}
Describe 'PowerShellGet Type tests' -tags @('CI') {
BeforeAll {
Import-Module PowerShellGet -Force
}
It 'Ensure PowerShellGet Types are available' {
$PowerShellGetNamespace = 'Microsoft.PowerShell.Commands.PowerShellGet'
$PowerShellGetTypeDetails = @{
InternalWebProxy = @('GetProxy', 'IsBypassed')
}
if((IsWindows)) {
$PowerShellGetTypeDetails['CERT_CHAIN_POLICY_PARA'] = @('cbSize','dwFlags','pvExtraPolicyPara')
$PowerShellGetTypeDetails['CERT_CHAIN_POLICY_STATUS'] = @('cbSize','dwError','lChainIndex','lElementIndex','pvExtraPolicyStatus')
$PowerShellGetTypeDetails['InternalSafeHandleZeroOrMinusOneIsInvalid'] = @('IsInvalid')
$PowerShellGetTypeDetails['InternalSafeX509ChainHandle'] = @('CertFreeCertificateChain','ReleaseHandle','InvalidHandle')
$PowerShellGetTypeDetails['Win32Helpers'] = @('CertVerifyCertificateChainPolicy', 'CertDuplicateCertificateChain', 'IsMicrosoftCertificate')
}
if('Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI' -as [Type]) {
$PowerShellGetTypeDetails['Telemetry'] = @('TraceMessageArtifactsNotFound', 'TraceMessageNonPSGalleryRegistration')
}
$PowerShellGetTypeDetails.GetEnumerator() | ForEach-Object {
$ClassName = $_.Name
$Type = "$PowerShellGetNamespace.$ClassName" -as [Type]
$Type | Select-Object -ExpandProperty Name | Should Be $ClassName
$_.Value | ForEach-Object { $Type.DeclaredMembers.Name -contains $_ | Should Be $true }
}
}
}
if($RegisteredINTRepo)
{
Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue | Unregister-PSRepository