/
fixtures.go
64 lines (50 loc) · 1.47 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
package testing
import (
"testing"
th "github.com/dynuc/gophercloud/testhelper"
"net/http"
"github.com/dynuc/gophercloud/testhelper/client"
"fmt"
)
var respOrder = `
{
"order_id": "dd0bdea6efe0"
}
`
var respBandwidth = `
{
"bandwidth": {
"id": "3fa5b383-5a73-4dcb-a314-c6128546d855",
"name": "test",
"size": 10,
"share_type": "PER",
"publicip_info": [
{
"publicip_id": "6285e7be-fd9f-497c-bc2d-dd0bdea6efe0",
"publicip_address": "161.xx.xx.9",
"publicip_type": "5_bgp",
"ip_version": 4
}
],
"tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
"bandwidth_type": "bgp"
}
}
`
// HandleWithBSSInfoSuccessfully for testing
func HandleWithBSSInfoSuccessfully(t *testing.T) {
th.Mux.HandleFunc("/v2.0/128a7bf965154373a7b73c89eb6b65aa/bandwidths/3fa5b383-5a73-4dcb-a314-c6128546d855", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "PUT")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, respOrder)
})
}
func HandleWithNameSuccessfully(t *testing.T) {
th.Mux.HandleFunc("/v2.0/128a7bf965154373a7b73c89eb6b65aa/bandwidths/3fa5b383-5a73-4dcb-a314-c6128546d855", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "PUT")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, respBandwidth)
})
}