blob: f319e540bb30d1abba8ee2a40a70d98bb790e164 [file] [log] [blame]
Jamie Hannaforde5145412014-11-06 12:35:59 +01001package sessions
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 TestEnable(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15
16 mockEnableResponse(t, lbID)
17
18 opts := CreateOpts{Type: HTTPCOOKIE}
19 err := Enable(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 := &SessionPersistence{Type: HTTPCOOKIE}
33 th.AssertDeepEquals(t, expected, sp)
34}
35
36func TestDisable(t *testing.T) {
37 th.SetupHTTP()
38 defer th.TeardownHTTP()
39
40 mockDisableResponse(t, lbID)
41
42 err := Disable(client.ServiceClient(), lbID).ExtractErr()
43 th.AssertNoErr(t, err)
44}