Skip to content

Commit

Permalink
Merge pull request #12 from SteelCrusaders/dev
Browse files Browse the repository at this point in the history
Merge upstream dev Changes
  • Loading branch information
PlagueHO authored Aug 29, 2016
2 parents 59483de + 8fa9bc8 commit b1ce54b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
9 changes: 0 additions & 9 deletions DSCResources/MSFT_xCertReq/MSFT_xCertReq.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -602,15 +602,6 @@ function Test-TargetResource
} # if
} # if

if (-not $cert.Verify())
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.InvalidCertificateMessage -f $Subject,$ca,$cert.Thumbprint)
) -join '' )
return $false
} # if

# The certificate was found and is OK - so no change required.
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ConvertFrom-StringData @'
ExpiringCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' is about to expire.
NoValidCertificateMessage = No valid certificate found with subject '{0}' issued by {1}.
ExpiredCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' has expired.
InvalidCertificateMessage = Teh certificate found with subject '{0}' issued by {1} with thumbprint '{2}' is inavlid.
InvalidCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' is inavlid.
ValidCertificateExistsMessage = Valid certificate '{2}' found with subject '{0}' issued by {1}.
CertificateReqNotFoundError = Certificate Request file '{0}' not found.
CertificateCerNotFoundError = Certificate file '{0}' not found.
Expand Down
20 changes: 0 additions & 20 deletions Tests/Unit/MSFT_xCertReq.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,6 @@ try
Add-Member -InputObject $expiredCert -MemberType ScriptMethod -Name Verify -Value {
return $true
}
$invalidCert = New-Object -TypeName PSObject -Property @{
Thumbprint = $validThumbprint
Subject = "CN=$validSubject"
Issuer = $validIssuer
NotBefore = (Get-Date).AddDays(-30) # Issued on
NotAfter = (Get-Date).AddDays(31) # Expires after
}
Add-Member -InputObject $invalidCert -MemberType ScriptMethod -Name Verify -Value {
return $false
}

$testUsername = 'DummyUsername'
$testPassword = 'DummyPassword'
Expand Down Expand Up @@ -627,16 +617,6 @@ RenewalCert = $validThumbprint
-Mockwith { $expiringCert }
Test-TargetResource @ParamsAutoRenew | Should Be $true
}
It 'returns true when a valid certificate already exists and is about to expire and autorenew set' {
Mock Get-ChildItem -ParameterFilter { $Path -eq 'Cert:\LocalMachine\My' } `
-Mockwith { $expiringCert }
Test-TargetResource @ParamsAutoRenew | Should Be $true
}
It 'returns false when a valid certificate already exists and is about to expire and autorenew not set' {
Mock Get-ChildItem -ParameterFilter { $Path -eq 'Cert:\LocalMachine\My' } `
-Mockwith { $invalidCert }
Test-TargetResource @Params | Should Be $false
}
}
}
}
Expand Down

0 comments on commit b1ce54b

Please sign in to comment.