mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
cfca: update test error message
This commit is contained in:
parent
1bbcc232db
commit
d2e96cff57
@ -39,19 +39,19 @@ func TestCreateCertificateRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
_, err = CreateCertificateRequest(random, template, "", "", "")
|
_, err = CreateCertificateRequest(random, template, "", "", "")
|
||||||
if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" {
|
if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" {
|
||||||
t.Fatal("certificate private key does not implement crypto.Signer")
|
t.Fatalf("expect certificate private key does not implement crypto.Signer, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCertificateRequest(random, template, certKey, "", "")
|
_, err = CreateCertificateRequest(random, template, certKey, "", "")
|
||||||
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
||||||
t.Fatal("only SM2 public key is supported")
|
t.Fatalf("expect only SM2 public key is supported, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCertificateRequest(random, template, certKey, invalidTmpKey.Public(), "")
|
_, err = CreateCertificateRequest(random, template, certKey, invalidTmpKey.Public(), "")
|
||||||
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
||||||
t.Fatal("only SM2 public key is supported")
|
t.Fatalf("expect only SM2 public key is supported, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "")
|
_, err = CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "")
|
||||||
if err == nil || err.Error() != "x509: challenge password is required" {
|
if err == nil || err.Error() != "x509: challenge password is required" {
|
||||||
t.Fatal("challenge password is required")
|
t.Fatalf("expect challenge password is required, got %v", err)
|
||||||
}
|
}
|
||||||
csrDer, err := CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "111111")
|
csrDer, err := CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "111111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -39,19 +39,19 @@ func TestCreateCFCACertificateRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
_, err = CreateCFCACertificateRequest(random, template, "", "", "")
|
_, err = CreateCFCACertificateRequest(random, template, "", "", "")
|
||||||
if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" {
|
if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" {
|
||||||
t.Fatal("certificate private key does not implement crypto.Signer")
|
t.Fatalf("expect certificate private key does not implement crypto.Signer, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCFCACertificateRequest(random, template, certKey, "", "")
|
_, err = CreateCFCACertificateRequest(random, template, certKey, "", "")
|
||||||
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
||||||
t.Fatal("only SM2 public key is supported")
|
t.Fatalf("expected only SM2 public key is supported, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCFCACertificateRequest(random, template, certKey, invalidTmpKey.Public(), "")
|
_, err = CreateCFCACertificateRequest(random, template, certKey, invalidTmpKey.Public(), "")
|
||||||
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
if err == nil || err.Error() != "x509: only SM2 public key is supported" {
|
||||||
t.Fatal("only SM2 public key is supported")
|
t.Fatalf("expect only SM2 public key is supported, got %v", err)
|
||||||
}
|
}
|
||||||
_, err = CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "")
|
_, err = CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "")
|
||||||
if err == nil || err.Error() != "x509: challenge password is required" {
|
if err == nil || err.Error() != "x509: challenge password is required" {
|
||||||
t.Fatal("challenge password is required")
|
t.Fatalf("expect challenge password is required, got %v", err)
|
||||||
}
|
}
|
||||||
csrDer, err := CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "111111")
|
csrDer, err := CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "111111")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user