rax accounts, containers acceptance tests
diff --git a/acceptance/rackspace/objectstorage/v1/accounts_test.go b/acceptance/rackspace/objectstorage/v1/accounts_test.go
new file mode 100644
index 0000000..3a05646
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/accounts_test.go
@@ -0,0 +1,37 @@
+// +build acceptance rackspace
+
+package v1
+
+import (
+ "testing"
+
+ raxAccounts "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/accounts"
+ th "github.com/rackspace/gophercloud/testhelper"
+)
+
+func TestAccounts(t *testing.T) {
+ c, err := createClient(t, false)
+ th.AssertNoErr(t, err)
+
+ headers, err := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).ExtractHeaders()
+ th.AssertNoErr(t, err)
+ t.Logf("Headers from Update Account request: %+v\n", headers)
+ defer func() {
+ _, err := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": ""}}).ExtractHeaders()
+ th.AssertNoErr(t, err)
+ metadata, err := raxAccounts.Get(c).ExtractMetadata()
+ th.AssertNoErr(t, err)
+ t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata)
+ th.CheckEquals(t, metadata["White"], "")
+ }()
+
+ getResult := raxAccounts.Get(c)
+ headers, err = getResult.ExtractHeaders()
+ th.AssertNoErr(t, err)
+ t.Logf("Headers from Get Account request (after update): %+v\n", headers)
+ metadata, err := getResult.ExtractMetadata()
+ th.AssertNoErr(t, err)
+ t.Logf("Metadata from Get Account request (after update): %+v\n", metadata)
+
+ th.CheckEquals(t, metadata["White"], "mountains")
+}
diff --git a/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go b/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go
new file mode 100644
index 0000000..b7b1f99
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go
@@ -0,0 +1 @@
+package v1
diff --git a/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go b/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go
new file mode 100644
index 0000000..b7b1f99
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/cdnobjects_test.go
@@ -0,0 +1 @@
+package v1
diff --git a/acceptance/rackspace/objectstorage/v1/common.go b/acceptance/rackspace/objectstorage/v1/common.go
new file mode 100644
index 0000000..0b4d170
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/common.go
@@ -0,0 +1,54 @@
+// +build acceptance rackspace
+
+package v1
+
+import (
+ "os"
+ "testing"
+
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/rackspace"
+ th "github.com/rackspace/gophercloud/testhelper"
+)
+
+func rackspaceAuthOptions(t *testing.T) gophercloud.AuthOptions {
+ // Obtain credentials from the environment.
+ options := gophercloud.AuthOptions{
+ Username: os.Getenv("RS_USERNAME"),
+ APIKey: os.Getenv("RS_APIKEY"),
+ }
+
+ if options.Username == "" {
+ t.Fatal("Please provide a Rackspace username as RS_USERNAME.")
+ }
+ if options.APIKey == "" {
+ t.Fatal("Please provide a Rackspace API key as RS_APIKEY.")
+ }
+
+ return options
+}
+
+func createClient(t *testing.T, cdn bool) (*gophercloud.ServiceClient, error) {
+ region := os.Getenv("RS_REGION")
+ if region == "" {
+ t.Fatal("Please provide a Rackspace region as RS_REGION")
+ }
+
+ ao := rackspaceAuthOptions(t)
+
+ provider, err := rackspace.NewClient(ao.IdentityEndpoint)
+ th.AssertNoErr(t, err)
+
+ err = rackspace.Authenticate(provider, ao)
+ th.AssertNoErr(t, err)
+
+ if cdn {
+ return rackspace.NewObjectCDNV1(provider, gophercloud.EndpointOpts{
+ Region: region,
+ })
+ }
+
+ return rackspace.NewObjectStorageV1(provider, gophercloud.EndpointOpts{
+ Region: region,
+ })
+}
diff --git a/acceptance/rackspace/objectstorage/v1/containers_test.go b/acceptance/rackspace/objectstorage/v1/containers_test.go
new file mode 100644
index 0000000..1e8ee36
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/containers_test.go
@@ -0,0 +1,87 @@
+// +build acceptance rackspace
+
+package v1
+
+import (
+ "testing"
+
+ osContainers "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers"
+ "github.com/rackspace/gophercloud/pagination"
+ raxContainers "github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers"
+ th "github.com/rackspace/gophercloud/testhelper"
+)
+
+func TestContainers(t *testing.T) {
+ c, err := createClient(t, false)
+ th.AssertNoErr(t, err)
+
+ t.Logf("Containers Info available to the currently issued token:")
+ count := 0
+ err = raxContainers.List(c, &osContainers.ListOpts{Full: true}).EachPage(func(page pagination.Page) (bool, error) {
+ t.Logf("--- Page %02d ---", count)
+
+ containers, err := raxContainers.ExtractInfo(page)
+ th.AssertNoErr(t, err)
+
+ for i, container := range containers {
+ t.Logf("[%02d] name=[%s]", i, container.Name)
+ t.Logf(" count=[%d]", container.Count)
+ t.Logf(" bytes=[%d]", container.Bytes)
+ }
+
+ count++
+ return true, nil
+ })
+ th.AssertNoErr(t, err)
+ if count == 0 {
+ t.Errorf("No containers listed for your current token.")
+ }
+
+ t.Logf("Container Names available to the currently issued token:")
+ count = 0
+ err = raxContainers.List(c, &osContainers.ListOpts{Full: false}).EachPage(func(page pagination.Page) (bool, error) {
+ t.Logf("--- Page %02d ---", count)
+
+ names, err := raxContainers.ExtractNames(page)
+ th.AssertNoErr(t, err)
+
+ for i, name := range names {
+ t.Logf("[%02d] %s", i, name)
+ }
+
+ count++
+ return true, nil
+ })
+ th.AssertNoErr(t, err)
+ if count == 0 {
+ t.Errorf("No containers listed for your current token.")
+ }
+
+ headers, err := raxContainers.Create(c, "gophercloud-test", nil).ExtractHeaders()
+ th.AssertNoErr(t, err)
+ defer func() {
+ _, err := raxContainers.Delete(c, "gophercloud-test").ExtractHeaders()
+ th.AssertNoErr(t, err)
+ }()
+
+ headers, err = raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).ExtractHeaders()
+ th.AssertNoErr(t, err)
+ t.Logf("Headers from Update Account request: %+v\n", headers)
+ defer func() {
+ _, err := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": ""}}).ExtractHeaders()
+ th.AssertNoErr(t, err)
+ metadata, err := raxContainers.Get(c, "gophercloud-test").ExtractMetadata()
+ th.AssertNoErr(t, err)
+ t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata)
+ th.CheckEquals(t, metadata["White"], "")
+ }()
+
+ getResult := raxContainers.Get(c, "gophercloud-test")
+ headers, err = getResult.ExtractHeaders()
+ th.AssertNoErr(t, err)
+ t.Logf("Headers from Get Account request (after update): %+v\n", headers)
+ metadata, err := getResult.ExtractMetadata()
+ th.AssertNoErr(t, err)
+ t.Logf("Metadata from Get Account request (after update): %+v\n", metadata)
+ th.CheckEquals(t, metadata["White"], "mountains")
+}
diff --git a/acceptance/rackspace/objectstorage/v1/objects_test.go b/acceptance/rackspace/objectstorage/v1/objects_test.go
new file mode 100644
index 0000000..b7b1f99
--- /dev/null
+++ b/acceptance/rackspace/objectstorage/v1/objects_test.go
@@ -0,0 +1 @@
+package v1