-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathoids_test.go
29 lines (25 loc) · 1.06 KB
/
oids_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
package libICP
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_OID_Key2String(t *testing.T) {
assert.Equal(t, "C", oid_key2str(idCountryName))
assert.Equal(t, "S", oid_key2str(idStateOrProvinceName))
assert.Equal(t, "L", oid_key2str(idLocalityName))
assert.Equal(t, "O", oid_key2str(idOrganizationName))
assert.Equal(t, "OU", oid_key2str(idOrganizationalUnitName))
assert.Equal(t, "CN", oid_key2str(idCommonName))
assert.Equal(t, "1.2.840.113549.1.7.1", oid_key2str(idData))
}
func Test_OID_2String2Key(t *testing.T) {
assert.True(t, str2oid_key("C").Equal(idCountryName))
assert.True(t, str2oid_key("S").Equal(idStateOrProvinceName))
assert.True(t, str2oid_key("L").Equal(idLocalityName))
assert.True(t, str2oid_key("O").Equal(idOrganizationName))
assert.True(t, str2oid_key("OU").Equal(idOrganizationalUnitName))
assert.True(t, str2oid_key("CN").Equal(idCommonName))
assert.True(t, str2oid_key("EMAIL").Equal(idEmailName))
assert.Nil(t, str2oid_key("1.2.840.113549.1.7.1a"))
assert.True(t, str2oid_key("1.2.840.113549.1.7.1").Equal(idData))
}