-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.go
92 lines (82 loc) · 2.09 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
package testing
import (
"testing"
"github.com/gophercloud/gophercloud/openstack/vpc/v2.0/publicips"
th "github.com/gophercloud/gophercloud/testhelper"
"net/http"
"github.com/gophercloud/gophercloud/testhelper/client"
"fmt"
)
func HandleOndemandSuccessfully(t *testing.T) {
th.Mux.HandleFunc("/v2.0/128a7bf965154373a7b73c89eb6b65aa/publicips", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "POST")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
//w.WriteHeader(http.StatusCreated)
fmt.Fprintf(w, OndemandResp)
})
}
func HandleWithBSSInfoSuccessfully(t *testing.T) {
th.Mux.HandleFunc("/v2.0/128a7bf965154373a7b73c89eb6b65aa/publicips", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "POST")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
fmt.Fprintf(w, BSSResp)
})
}
var OndemandResp = `
{
"publicip": {
"id": "f588ccfa-8750-4d7c-bf5d-2ede24414706",
"status": "PENDING_CREATE",
"type": "5_bgp",
"public_ip_address": "161.17.101.7",
"tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
"create_time": "2015-07-16 04:10:52",
"bandwidth_size": 2,
"ip_version": 4
}
}
`
var BSSResp = `
{
"order_id": "CS1802081410IMDRN",
"publicip_id": "f588ccfa-8750-4d7c-bf5d-2ede24414706"
}
`
var (
size = 2
pernum = 1
ipver = 4
)
var CreateResultForBSS = publicips.PrePaid{
OrderID: "CS1802081410IMDRN",
PublicipID: "f588ccfa-8750-4d7c-bf5d-2ede24414706",
}
var OndmandOpts = publicips.CreateOpts{
PublicIP: publicips.PublicIP{
Type: "5_bgp",
IPVersion: ipver,},
Bandwidth: publicips.Bandwidth{
Name: "test1",
Size: size,
ShareType: "PER",
ChargeMode: "bandwidth",
},
}
var BSSOpts = publicips.CreateOpts{
PublicIP: publicips.PublicIP{
Type: "5_bgp",
},
Bandwidth: publicips.Bandwidth{
Name: "test1",
Size: size,
ShareType: "PER",
ChargeMode: "bandwidth",
},
ExtendParam: publicips.ExtendParam{
ChargeMode: "prePaid",
PeriodNum: pernum,
PeriodType: "month",
IsAutoPay: "true",
IsAutoRenew: "false",
},
}