mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Clean up certs_test.go a bit
This commit is contained in:
parent
a217f88ea1
commit
2e129b9dc8
1 changed files with 8 additions and 10 deletions
|
|
@ -3,26 +3,24 @@ package certs
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
func TestLoadCertificates(t *testing.T) {
|
func TestLoadCertificates(t *testing.T) {
|
||||||
goodTestCert := "data/testclient.crt"
|
TestCert := "data/testclient.crt"
|
||||||
goodTestkey := "data/testclientkey.pem"
|
Testkey := "data/testclientkey.pem"
|
||||||
goodPassphrase := "security123"
|
Passphrase := "security123"
|
||||||
// missingTestCert := "data/testclient_missing.crt"
|
|
||||||
missingTestkey := "data/testclientkey_missing.pem"
|
missingTestkey := "data/testclientkey_missing.pem"
|
||||||
// missingPassphrase := ""
|
|
||||||
|
|
||||||
if certificate, err := LoadCertificate(&goodTestCert, &goodTestkey, nil); certificate == nil || err != nil {
|
if certificate, err := LoadCertificate(&TestCert, &Testkey, nil); certificate == nil || err != nil {
|
||||||
t.Errorf("Failure: Couldn't load supposedly valid certificate.")
|
t.Errorf("Failure: Couldn't load supposedly valid certificate.")
|
||||||
}
|
}
|
||||||
if certificate, err := LoadCertificate(nil, &goodTestkey, nil); certificate != nil || err == nil {
|
if certificate, err := LoadCertificate(nil, &Testkey, nil); certificate != nil || err == nil {
|
||||||
t.Errorf("Failure: No error despite missing certificate")
|
t.Errorf("Failure: No error despite missing certificate")
|
||||||
}
|
}
|
||||||
if certificate, err := LoadCertificate(&goodTestCert, &missingTestkey, nil); certificate != nil || err == nil {
|
if certificate, err := LoadCertificate(&TestCert, &missingTestkey, nil); certificate != nil || err == nil {
|
||||||
t.Errorf("Failure: No Failure while loading certificate using missing key.")
|
t.Errorf("Failure: No Failure while loading certificate using missing key.")
|
||||||
}
|
}
|
||||||
if certificate, err := LoadCertificate(&goodTestCert, &goodTestkey, &goodPassphrase); certificate == nil || err != nil {
|
if certificate, err := LoadCertificate(&TestCert, &Testkey, &Passphrase); certificate == nil || err != nil {
|
||||||
t.Errorf("Failure: Couldn't load supposedly valid certificate with passphrase.")
|
t.Errorf("Failure: Couldn't load supposedly valid certificate with passphrase.")
|
||||||
}
|
}
|
||||||
if certificate, err := LoadCertificate(&goodTestCert, &missingTestkey, &goodPassphrase); certificate != nil || err == nil {
|
if certificate, err := LoadCertificate(&TestCert, &missingTestkey, &Passphrase); certificate != nil || err == nil {
|
||||||
t.Errorf("Failure: No Failure while loading certificate using missing key with passphrase.")
|
t.Errorf("Failure: No Failure while loading certificate using missing key with passphrase.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue