blob: 6e9703ffce33f7178acc7b13a16a010be2bba3cf [file] [log] [blame]
Jamie Hannaford1ba046f2014-11-06 13:21:30 +01001package throttle
2
3import (
4 "testing"
5
6 th "github.com/rackspace/gophercloud/testhelper"
7 "github.com/rackspace/gophercloud/testhelper/client"
8)
9
10const lbID = 12345
11
12func TestCreate(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15
16 mockCreateResponse(t, lbID)
17
18 opts := CreateOpts{MaxConnections: 200}
19 err := Create(client.ServiceClient(), lbID, opts).ExtractErr()
20 th.AssertNoErr(t, err)
21}
22
23func TestGet(t *testing.T) {
24 th.SetupHTTP()
25 defer th.TeardownHTTP()
26
27 mockGetResponse(t, lbID)
28
29 sp, err := Get(client.ServiceClient(), lbID).Extract()
30 th.AssertNoErr(t, err)
31
32 expected := &ConnectionThrottle{MaxConnections: 100}
33 th.AssertDeepEquals(t, expected, sp)
34}
35
36func TestDelete(t *testing.T) {
37 th.SetupHTTP()
38 defer th.TeardownHTTP()
39
40 mockDeleteResponse(t, lbID)
41
42 err := Delete(client.ServiceClient(), lbID).ExtractErr()
43 th.AssertNoErr(t, err)
44}