Adds module code structure, build script, test script, and API bindings
This commit is contained in:
47
Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1
Normal file
47
Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1
Normal file
@@ -0,0 +1,47 @@
|
||||
#**************************************************************************
|
||||
# Copyright (c) VMware, Inc. All rights reserved.
|
||||
#**************************************************************************
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcAddress,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcUser,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcUserPassword
|
||||
)
|
||||
|
||||
# Import Vmware.vSphere.SsoAdmin Module
|
||||
$modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1"
|
||||
Import-Module $modulePath
|
||||
|
||||
$script:lsClient = $null
|
||||
|
||||
Describe "Lookup Service Client Integration Tests" {
|
||||
Context "Retrieval of SsoAdmin API Url" {
|
||||
BeforeAll {
|
||||
## Create LsClient
|
||||
$skipCertificateCheckValidator = New-Object `
|
||||
'VMware.vSphere.SsoAdmin.Utils.AcceptAllX509CertificateValidator'
|
||||
|
||||
$script:lsClient = New-Object `
|
||||
'VMware.vSphere.LsClient.LookupServiceClient' `
|
||||
-ArgumentList @($VCAddress, $skipCertificateCheckValidator)
|
||||
|
||||
}
|
||||
|
||||
It 'Gets SsoAdmin API Url' {
|
||||
# Act
|
||||
$actual = $script:lsClient.GetSsoAdminEndpointUri()
|
||||
|
||||
# Assert
|
||||
$actual | Should Not Be $null
|
||||
$actual.ToString().StartsWith("https://$VCAddress/sso-adminserver/sdk/") | Should Be $true
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
Normal file
38
Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
#**************************************************************************
|
||||
# Copyright (c) VMware, Inc. All rights reserved.
|
||||
#**************************************************************************
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcAddress,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcUser,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$VcUserPassword
|
||||
)
|
||||
|
||||
function Test-PesterIsAvailable() {
|
||||
$pesterModule = Get-Module Pester -List
|
||||
if ($pesterModule -eq $null) {
|
||||
throw "Pester Module is not available"
|
||||
}
|
||||
}
|
||||
|
||||
Test-PesterIsAvailable
|
||||
|
||||
$testFiles = Get-ChildItem -Path $PSScriptRoot -Filter "*.Tests.ps1"
|
||||
|
||||
Invoke-Pester `
|
||||
-Script @{
|
||||
Path = $PSScriptRoot
|
||||
Parameters = @{
|
||||
VcAddress = $VcAddress
|
||||
VcUser = $VcUser
|
||||
VcUserPassword = $VcUserPassword
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user