forked from sapcc/go-vice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetOrgInfo_test.go
63 lines (55 loc) · 1.31 KB
/
getOrgInfo_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
51
52
53
54
55
56
57
58
59
60
61
62
63
package vice
import (
"encoding/xml"
"testing"
"github.com/stretchr/testify/assert"
)
const getOrgInfoResponse = `
<Response xmlns:tns="http://webservices.mpki4ssl.verisign.com">
<StatusCode>0x00</StatusCode>
<Message>success</Message>
<Organization name="ECorp">
<OrgStatus>Valid</OrgStatus>
<AuthStatus>Authenticated</AuthStatus>
<EV_Enabled>Yes</EV_Enabled>
<AuthExpires>12/13/2018</AuthExpires>
<OrgContact>
<FirstName>Max</FirstName>
<LastName>Cloud</LastName>
<Phone>012345678</Phone>
<Email>[email protected]</Email>
</OrgContact>
<OrgAddress>
<Address>Cloud-Allee 16</Address>
<City>Berlin</City>
<State>Berlin</State>
<Zip>10178</Zip>
<Country>DE</Country>
</OrgAddress>
</Organization>
</Response>
`
func TestGetOrgInfo(t *testing.T) {
expectedOrgInfo := _Organization{
Name: "ECorp",
OrgStatus: "Valid",
AuthStatus: "Authenticated",
EVEnabled: "Yes",
AuthExpires: NewSimpleTime(13, 12, 2018),
OrgContact: _OrgContact{
FirstName: "Max",
LastName: "Cloud",
Phone: "012345678",
Email: "[email protected]",
},
OrgAddress: _OrgAddress{
City: "Berlin",
State: "Berlin",
Country: "DE",
},
}
var orgInfo OrganizationInfo
xml.Unmarshal([]byte(getOrgInfoResponse), &orgInfo)
assert.NotNil(t, orgInfo)
assert.Equal(t, expectedOrgInfo, orgInfo.Organization)
}