-
Notifications
You must be signed in to change notification settings - Fork 4
/
status_test.go
50 lines (39 loc) · 1009 Bytes
/
status_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"math/big"
"testing"
"time"
)
func TestStatusString(t *testing.T) {
s := new(big.Int)
s.SetString("17015245701990644280577643802745589798", 10)
st := &Status{
SerialNumber: s,
Status: "Good",
}
got := st.String()
expected := "Serial number: 17015245701990644280577643802745589798\n\n" +
"Status: Good\n"
if got != expected {
t.Errorf("expected %q, got %q", expected, got)
}
}
func TestStatusWithReasonString(t *testing.T) {
s := new(big.Int)
s.SetString("17015245701990644280577643802745589799", 10)
tt := time.Date(2017, 12, 24, 23, 59, 59, 0, time.UTC)
st := &Status{
SerialNumber: s,
Status: "Revoked",
Reason: "Key compromise",
RevokedAt: tt,
}
got := st.String()
expected := "Serial number: 17015245701990644280577643802745589799\n\n" +
"Status: Revoked\n" +
"Reason: Key compromise\n" +
"Revoked at: 2017-12-24 23:59:59 +0000 UTC\n"
if got != expected {
t.Errorf("expected %q, got %q", expected, got)
}
}