blob: 6550283df71c2e99cc191c03523b0b8038fe8f18 [file] [log] [blame]
Jamie Hannaford2aaf1a62014-10-16 12:55:50 +02001package extensions
2
3import (
4 "testing"
5
6 "github.com/rackspace/gophercloud/pagination"
7 th "github.com/rackspace/gophercloud/testhelper"
8 "github.com/rackspace/gophercloud/testhelper/client"
9)
10
11func TestList(t *testing.T) {
12 th.SetupHTTP()
13 defer th.TeardownHTTP()
14 HandleListExtensionsSuccessfully(t)
15
16 count := 0
17
18 List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
19 count++
20 actual, err := ExtractExtensions(page)
21 th.AssertNoErr(t, err)
22 th.AssertDeepEquals(t, ExpectedExtensions, actual)
23
24 return true, nil
25 })
26
27 th.CheckEquals(t, 1, count)
28}
29
30func TestGet(t *testing.T) {
31 th.SetupHTTP()
32 defer th.TeardownHTTP()
33 HandleGetExtensionSuccessfully(t)
34
35 actual, err := Get(client.ServiceClient(), "agent").Extract()
36 th.AssertNoErr(t, err)
37 th.CheckDeepEquals(t, SingleExtension, actual)
38}