/
fixtures.go
117 lines (109 loc) · 2.94 KB
/
fixtures.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package testing
import (
"time"
"github.com/selectel/go-selvpcclient/selvpcclient"
"github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/traffic"
)
// TestGetTrafficRaw represents a raw response from the Get request.
const TestGetTrafficRaw = `
{
"traffic": {
"domain": {
"paid": {
"start": "2018-04-01T00:00:00",
"stop": "2018-04-30T23:59:59",
"unit": "B",
"value": 0
},
"prepaid": {
"start": "2018-04-01T00:00:00",
"stop": "2018-04-30T23:59:59",
"unit": "B",
"value": 3000000000000
},
"used": {
"start": "2018-04-01T00:00:00",
"stop": "2018-04-30T23:59:59",
"unit": "B",
"value": 658003816
}
},
"projects": {}
}
}
`
// TestGetTrafficUsedRaw represents a raw response from the Get request with
// only used traffic.
const TestGetTrafficUsedRaw = `
{
"traffic": {
"domain": {
"used": {
"start": "2018-04-01T00:00:00",
"stop": "2018-04-30T23:59:59",
"unit": "B",
"value": 658003816
}
},
"projects": {}
}
}
`
var (
trafficStartTimeStamp, _ = time.Parse(selvpcclient.RFC3339NoZ, "2018-04-01T00:00:00")
trafficStopTimeStamp, _ = time.Parse(selvpcclient.RFC3339NoZ, "2018-04-30T23:59:59")
)
// TestGetTrafficUsed represents the unmarshalled TestGetTrafficUsedRaw response.
var TestGetTrafficUsed = &traffic.DomainTraffic{
DomainData: []*traffic.Traffic{
{
Type: "used",
TrafficData: traffic.Data{
Start: trafficStartTimeStamp,
Stop: trafficStopTimeStamp,
Unit: "B",
Value: 658003816,
},
},
},
}
// TestGetTrafficInvalidTimestampsRaw represents a raw response from the Get request
// with invalid timestamps.
const TestGetTrafficInvalidTimestampsRaw = `
{
"traffic": {
"domain": {
"paid": {
"start": "2006-01-02T15:04:05.999999+00:00",
"stop": "2006-01-20T15:04:05.999999+00:00",
"unit": "B",
"value": 0
},
"prepaid": {
"start": "2006-01-02T15:04:05.999999+00:00",
"stop": "2006-01-20T15:04:05.999999+00:00",
"unit": "B",
"value": 3000000000000
},
"used": {
"start": "2006-01-02T15:04:05.999999+00:00",
"stop": "2006-01-20T15:04:05.999999+00:00",
"unit": "B",
"value": 658003816
}
},
"projects": {}
}
}
`
// TestGetTrafficInvalidDataResponseRaw represents a raw response from the Get request
// with invalid traffic data.
const TestGetTrafficInvalidDataResponseRaw = `
{
"traffic": {
"domain": {
123: {}
}
}
}
`