rackspace object storage acceptance tests fixes
diff --git a/acceptance/rackspace/identity/v2/identity_test.go b/acceptance/rackspace/identity/v2/identity_test.go
index 576e40f..1182982 100644
--- a/acceptance/rackspace/identity/v2/identity_test.go
+++ b/acceptance/rackspace/identity/v2/identity_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/acceptance/tools"
"github.com/rackspace/gophercloud/rackspace"
th "github.com/rackspace/gophercloud/testhelper"
)
diff --git a/acceptance/rackspace/objectstorage/v1/accounts_test.go b/acceptance/rackspace/objectstorage/v1/accounts_test.go
index e5c75fc..145e4e0 100644
--- a/acceptance/rackspace/objectstorage/v1/accounts_test.go
+++ b/acceptance/rackspace/objectstorage/v1/accounts_test.go
@@ -13,12 +13,12 @@
c, err := createClient(t, false)
th.AssertNoErr(t, err)
- headers, err := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).Extract()
- th.AssertNoErr(t, err)
- t.Logf("Headers from Update Account request: %+v\n", headers)
+ updateres := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": "mountains"}})
+ th.AssertNoErr(t, updateres.Err)
+ t.Logf("Headers from Update Account request: %+v\n", updateres.Header)
defer func() {
- _, err := raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": ""}}).Extract()
- th.AssertNoErr(t, err)
+ updateres = raxAccounts.Update(c, raxAccounts.UpdateOpts{Metadata: map[string]string{"white": ""}})
+ th.AssertNoErr(t, updateres.Err)
metadata, err := raxAccounts.Get(c).ExtractMetadata()
th.AssertNoErr(t, err)
t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata)
diff --git a/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go b/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go
index 4530a5b..e1bf38b 100644
--- a/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go
+++ b/acceptance/rackspace/objectstorage/v1/cdncontainers_test.go
@@ -16,12 +16,12 @@
raxClient, err := createClient(t, false)
th.AssertNoErr(t, err)
- headers, err := raxContainers.Create(raxClient, "gophercloud-test", nil).Extract()
- th.AssertNoErr(t, err)
- t.Logf("Headers from Create Container request: %+v\n", headers)
+ createres := raxContainers.Create(raxClient, "gophercloud-test", nil)
+ th.AssertNoErr(t, createres.Err)
+ t.Logf("Headers from Create Container request: %+v\n", createres.Header)
defer func() {
- _, err := raxContainers.Delete(raxClient, "gophercloud-test").Extract()
- th.AssertNoErr(t, err)
+ res := raxContainers.Delete(raxClient, "gophercloud-test")
+ th.AssertNoErr(t, res.Err)
}()
raxCDNClient, err := createClient(t, true)
@@ -48,12 +48,12 @@
})
th.AssertNoErr(t, err)
if count == 0 {
- t.Errorf("No containers listed for your current token.")
+ t.Errorf("No CDN containers listed for your current token.")
}
- headers, err = raxCDNContainers.Update(raxCDNClient, "gophercloud-test", raxCDNContainers.UpdateOpts{CDNEnabled: false}).Extract()
- th.AssertNoErr(t, err)
- t.Logf("Headers from Update CDN Container request: %+v\n", headers)
+ updateres := raxCDNContainers.Update(raxCDNClient, "gophercloud-test", raxCDNContainers.UpdateOpts{CDNEnabled: false})
+ th.AssertNoErr(t, updateres.Err)
+ t.Logf("Headers from Update CDN Container request: %+v\n", updateres.Header)
metadata, err := raxCDNContainers.Get(raxCDNClient, "gophercloud-test").ExtractMetadata()
th.AssertNoErr(t, err)
diff --git a/acceptance/rackspace/objectstorage/v1/common.go b/acceptance/rackspace/objectstorage/v1/common.go
index 59457c1..1ae0727 100644
--- a/acceptance/rackspace/objectstorage/v1/common.go
+++ b/acceptance/rackspace/objectstorage/v1/common.go
@@ -7,6 +7,7 @@
"testing"
"github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/acceptance/tools"
"github.com/rackspace/gophercloud/rackspace"
th "github.com/rackspace/gophercloud/testhelper"
)
diff --git a/acceptance/rackspace/objectstorage/v1/containers_test.go b/acceptance/rackspace/objectstorage/v1/containers_test.go
index d22057b..a7339cf 100644
--- a/acceptance/rackspace/objectstorage/v1/containers_test.go
+++ b/acceptance/rackspace/objectstorage/v1/containers_test.go
@@ -57,30 +57,28 @@
t.Errorf("No containers listed for your current token.")
}
- headers, err := raxContainers.Create(c, "gophercloud-test", nil).ExtractHeaders()
- th.AssertNoErr(t, err)
+ createres := raxContainers.Create(c, "gophercloud-test", nil)
+ th.AssertNoErr(t, createres.Err)
defer func() {
- _, err := raxContainers.Delete(c, "gophercloud-test").ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxContainers.Delete(c, "gophercloud-test")
+ th.AssertNoErr(t, res.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)
+ updateres := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": "mountains"}})
+ th.AssertNoErr(t, updateres.Err)
+ t.Logf("Headers from Update Account request: %+v\n", updateres.Header)
defer func() {
- _, err := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": ""}}).ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxContainers.Update(c, "gophercloud-test", raxContainers.UpdateOpts{Metadata: map[string]string{"white": ""}})
+ th.AssertNoErr(t, res.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()
+ getres := raxContainers.Get(c, "gophercloud-test")
+ t.Logf("Headers from Get Account request (after update): %+v\n", getres.Header)
+ metadata, err := getres.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
index 749f6d3..462f284 100644
--- a/acceptance/rackspace/objectstorage/v1/objects_test.go
+++ b/acceptance/rackspace/objectstorage/v1/objects_test.go
@@ -17,21 +17,21 @@
c, err := createClient(t, false)
th.AssertNoErr(t, err)
- _, err = raxContainers.Create(c, "gophercloud-test", nil).ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxContainers.Create(c, "gophercloud-test", nil)
+ th.AssertNoErr(t, res.Err)
defer func() {
- _, err := raxContainers.Delete(c, "gophercloud-test").ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxContainers.Delete(c, "gophercloud-test")
+ th.AssertNoErr(t, res.Err)
}()
content := bytes.NewBufferString("Lewis Carroll")
options := &osObjects.CreateOpts{ContentType: "text/plain"}
- _, err = raxObjects.Create(c, "gophercloud-test", "o1", content, options).ExtractHeaders()
- th.AssertNoErr(t, err)
+ createres := raxObjects.Create(c, "gophercloud-test", "o1", content, options)
+ th.AssertNoErr(t, createres.Err)
defer func() {
- _, err := raxObjects.Delete(c, "gophercloud-test", "o1", nil).ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxObjects.Delete(c, "gophercloud-test", "o1", nil)
+ th.AssertNoErr(t, res.Err)
}()
t.Logf("Objects Info available to the currently issued token:")
@@ -77,11 +77,11 @@
t.Errorf("No objects listed for your current token.")
}
- _, err = raxObjects.Copy(c, "gophercloud-test", "o1", &raxObjects.CopyOpts{Destination: "gophercloud-test/o2"}).ExtractHeaders()
- th.AssertNoErr(t, err)
+ copyres := raxObjects.Copy(c, "gophercloud-test", "o1", &raxObjects.CopyOpts{Destination: "gophercloud-test/o2"})
+ th.AssertNoErr(t, copyres.Err)
defer func() {
- _, err := raxObjects.Delete(c, "gophercloud-test", "o2", nil).ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxObjects.Delete(c, "gophercloud-test", "o2", nil)
+ th.AssertNoErr(t, res.Err)
}()
o1Content, err := raxObjects.Download(c, "gophercloud-test", "o1", nil).ExtractContent()
@@ -90,23 +90,22 @@
th.AssertNoErr(t, err)
th.AssertEquals(t, string(o2Content), string(o1Content))
- headers, err := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": "mountains"}}).ExtractHeaders()
- th.AssertNoErr(t, err)
- t.Logf("Headers from Update Account request: %+v\n", headers)
+ updateres := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": "mountains"}})
+ th.AssertNoErr(t, updateres.Err)
+ t.Logf("Headers from Update Account request: %+v\n", updateres.Header)
defer func() {
- _, err := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": ""}}).ExtractHeaders()
- th.AssertNoErr(t, err)
+ res := raxObjects.Update(c, "gophercloud-test", "o2", osObjects.UpdateOpts{Metadata: map[string]string{"white": ""}})
+ th.AssertNoErr(t, res.Err)
metadata, err := raxObjects.Get(c, "gophercloud-test", "o2", nil).ExtractMetadata()
th.AssertNoErr(t, err)
t.Logf("Metadata from Get Account request (after update reverted): %+v\n", metadata)
th.CheckEquals(t, metadata["White"], "")
}()
- getResult := raxObjects.Get(c, "gophercloud-test", "o2", nil)
- headers, err = getResult.ExtractHeaders()
- th.AssertNoErr(t, err)
- t.Logf("Headers from Get Account request (after update): %+v\n", headers)
- metadata, err := getResult.ExtractMetadata()
+ getres := raxObjects.Get(c, "gophercloud-test", "o2", nil)
+ th.AssertNoErr(t, getres.Err)
+ t.Logf("Headers from Get Account request (after update): %+v\n", getres.Header)
+ metadata, err := getres.ExtractMetadata()
th.AssertNoErr(t, err)
t.Logf("Metadata from Get Account request (after update): %+v\n", metadata)
th.CheckEquals(t, metadata["White"], "mountains")