blob: a294f7e29e8888671088d8f4c68cfccf2677fb25 [file] [log] [blame]
Jon Perrittb5c78122014-10-15 20:44:39 -05001package cdncontainers
Jon Perritt0ba5a562014-10-15 23:23:12 -05002
3import (
4 "testing"
5
6 os "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers"
7 "github.com/rackspace/gophercloud/pagination"
8 th "github.com/rackspace/gophercloud/testhelper"
9 fake "github.com/rackspace/gophercloud/testhelper/client"
10)
11
12func TestListCDNContainers(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15 os.HandleListContainerNamesSuccessfully(t)
16
17 count := 0
18 err := List(fake.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
19 count++
20 actual, err := ExtractNames(page)
21 th.AssertNoErr(t, err)
22
23 th.CheckDeepEquals(t, os.ExpectedListNames, actual)
24
25 return true, nil
26 })
27 th.AssertNoErr(t, err)
28 th.CheckEquals(t, count, 1)
29}
30
31func TestGetCDNContainer(t *testing.T) {
32 th.SetupHTTP()
33 defer th.TeardownHTTP()
34 os.HandleGetContainerSuccessfully(t)
35
36 _, err := Get(fake.ServiceClient(), "testContainer").ExtractMetadata()
37 th.CheckNoErr(t, err)
38
39}
40
41func TestUpdateCDNContainer(t *testing.T) {
42 th.SetupHTTP()
43 defer th.TeardownHTTP()
44 os.HandleUpdateContainerSuccessfully(t)
45
46 options := &UpdateOpts{TTL: 3600}
47 _, err := Update(fake.ServiceClient(), "testContainer", options).ExtractHeaders()
48 th.CheckNoErr(t, err)
49
50}