Rework locations of extracted structs
diff --git a/rackspace/db/v1/instances/requests_test.go b/rackspace/db/v1/instances/requests_test.go
index c746b6a..66d58fd 100644
--- a/rackspace/db/v1/instances/requests_test.go
+++ b/rackspace/db/v1/instances/requests_test.go
@@ -3,6 +3,8 @@
import (
"testing"
+ "github.com/rackspace/gophercloud/pagination"
+ "github.com/rackspace/gophercloud/rackspace/db/v1/backups"
th "github.com/rackspace/gophercloud/testhelper"
fake "github.com/rackspace/gophercloud/testhelper/client"
)
@@ -74,3 +76,41 @@
res := AssociateWithConfigGroup(fake.ServiceClient(), instanceID, configGroupID)
th.AssertNoErr(t, res.Err)
}
+
+func TestListBackups(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+
+ HandleListBackupsSuccessfully(t, instanceID)
+ count := 0
+
+ ListBackups(fake.ServiceClient(), instanceID).EachPage(func(page pagination.Page) (bool, error) {
+ count++
+ actual, err := backups.ExtractBackups(page)
+ th.AssertNoErr(t, err)
+
+ expected := []backups.Backup{
+ backups.Backup{
+ Created: "2014-06-18T21:23:35",
+ Description: "Backup from Restored Instance",
+ ID: "87972694-4be2-40f5-83f8-501656e0032a",
+ InstanceID: "29af2cd9-0674-48ab-b87a-b160f00208e6",
+ LocationRef: "http://localhost/path/to/backup",
+ Name: "restored_backup",
+ ParentID: "",
+ Size: 0.141026,
+ Status: "COMPLETED",
+ Updated: "2014-06-18T21:24:39",
+ Datastore: backups.Datastore{Version: "5.1", Type: "MySQL", VersionID: "20000000-0000-0000-0000-000000000002"},
+ },
+ }
+
+ th.AssertDeepEquals(t, expected, actual)
+
+ return true, nil
+ })
+
+ if count != 1 {
+ t.Errorf("Expected 1 page, got %d", count)
+ }
+}