forked from OCram85/PSCredentialStore
Migrates to Pester5+ tests (#59)
#### 📖 Summary - update Pester tests to Pester5+ compatiple layout - switch to dotnet base imaged - dotnet binary required for publishung powershell modules (Publish-Module) #### 📑 Test Plan > 💡 Select your test plan for the code changes. - [x] Tested via Drone.io pipeline - [ ] Custom test - [ ] No test plan ##### Details / Justification <!-- Add your test details or justification for missing tests here. --> #### 📚 Additional Notes <!-- A place for additional detail notes. --> Co-authored-by: OCram85 <marco.blessing@googlemail.com> Reviewed-on: OCram85/PSCredentialStore#59
This commit is contained in:
33
src/Certificate/New-CSCertificate.Tests.ps1
Normal file
33
src/Certificate/New-CSCertificate.Tests.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "New-CSCertificate" {
|
||||
Context "Basic Tests" -Tag 'Unit' {
|
||||
It "Should not throw" {
|
||||
$attribs = @{
|
||||
Country = 'DE'
|
||||
State = 'BW'
|
||||
City = 'KA'
|
||||
Organization = 'IT'
|
||||
OrganizationalUnitName = 'foo'
|
||||
CommonName = 'MyCert'
|
||||
}
|
||||
$CertAttribs = @{
|
||||
CRTAttribute = New-CSCertAttribute @attribs
|
||||
KeyName = Join-Path -Path (Get-TempDir) -ChildPath '/foo.key'
|
||||
CertName = Join-Path -Path (Get-TempDir) -ChildPath '/cert.pfx'
|
||||
}
|
||||
{ New-CSCertificate @CertAttribs } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user