-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnames_test.go
More file actions
49 lines (44 loc) · 1.1 KB
/
names_test.go
File metadata and controls
49 lines (44 loc) · 1.1 KB
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
package libICP
import (
"testing"
"github.com/OpenICP-BR/asn1"
"github.com/stretchr/testify/assert"
)
func Test_Name_String_1(t *testing.T) {
n := nameT{}
assert.Equal(t, "", n.String())
}
func Test_Name_String_2(t *testing.T) {
n := nameT{
rdn_set{
atv{Type: idEmailName, Value: "a@b.com"},
},
rdn_set{
atv{Type: idCountryName, Value: "BR"},
},
rdn_set{
atv{Type: idStateOrProvinceName, Value: "SP"},
},
rdn_set{
atv{Type: idCommonName, Value: "Random Cert"},
},
rdn_set{
atv{Type: asn1.ObjectIdentifier{1, 2}, Value: "First unknown oid"},
},
rdn_set{
atv{Type: asn1.ObjectIdentifier{1, 3, 840}, Value: "Second unkown oid"},
},
}
assert.Equal(t, "C=BR/S=SP/CN=Random Cert/EMAIL=a@b.com/1.2=First unknown oid/1.3.840=Second unkown oid", n.String())
}
func Test_Name_String_3(t *testing.T) {
n := nameT{
rdn_set{
atv{Type: asn1.ObjectIdentifier{1, 2}, Value: "First unknown oid"},
},
rdn_set{
atv{Type: asn1.ObjectIdentifier{1, 3, 840}, Value: "Second unkown oid"},
},
}
assert.Equal(t, "1.2=First unknown oid/1.3.840=Second unkown oid", n.String())
}