mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
fix LoadCertificate unit test
replaced certificate with invalid dns name, which is rejected by stdlib of Go version >=1.25.2. Change in Go introduced by https://github.com/golang/go/issues/75715
This commit is contained in:
parent
05eae0a9ae
commit
3211ce4b76
3 changed files with 52 additions and 77 deletions
|
|
@ -26,7 +26,7 @@ func TestLoadCertificates(t *testing.T) {
|
|||
|
||||
// Try to load cert that is not protected, expect success.
|
||||
if cert, err := LoadCertificate(&testCert, &testKey, nil); cert == nil || err != nil {
|
||||
t.Errorf("Failure: Couldn't load supposedly valid certificate.")
|
||||
t.Errorf("Failure: Couldn't load supposedly valid certificate. Got error: %v", err)
|
||||
}
|
||||
// Try to load no cert, expect error.
|
||||
if cert, err := LoadCertificate(nil, &testKey, nil); cert != nil || err == nil {
|
||||
|
|
@ -46,7 +46,7 @@ func TestLoadCertificates(t *testing.T) {
|
|||
}
|
||||
// Try to load encrypted cert, expecting success.
|
||||
if cert, err := LoadCertificate(&privateCert, &privateKey, &passphrase); cert == nil || err != nil {
|
||||
t.Errorf("Failure: Couldn't load supposedly valid encrypted certificate.")
|
||||
t.Errorf("Failure: Couldn't load supposedly valid encrypted certificate. Got error: %v", err)
|
||||
}
|
||||
// Try to load wrong encrypted cert, expecting error.
|
||||
if cert, err := LoadCertificate(&testKey, &privateKey, &passphrase); cert != nil || err == nil {
|
||||
|
|
@ -56,8 +56,8 @@ func TestLoadCertificates(t *testing.T) {
|
|||
if cert, err := LoadCertificate(&missingCert, &privateKey, &passphrase); cert != nil || err == nil {
|
||||
t.Errorf("Failure: No Failure while loading nonexistens certificate.")
|
||||
}
|
||||
// Try to load nonexistent encrypted cert, expecting error.
|
||||
// Try to load nonexistent encrypted cert, expecting success.
|
||||
if cert, err := LoadCertificate(nil, nil, nil); cert != nil || err != nil {
|
||||
t.Errorf("Failure: Expected nil return.")
|
||||
t.Errorf("Failure: Expected nil return. Got error: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue