Override the ExtractExtensions function.
It turns out that identity changes the response body structure.
diff --git a/openstack/identity/v2/extensions/delegate_test.go b/openstack/identity/v2/extensions/delegate_test.go
index 5cc7c12..90eb21b 100644
--- a/openstack/identity/v2/extensions/delegate_test.go
+++ b/openstack/identity/v2/extensions/delegate_test.go
@@ -26,7 +26,7 @@
th.SetupHTTP()
defer th.TeardownHTTP()
- th.Mux.HandleFunc("/v2.0/extensions", func(w http.ResponseWriter, r *http.Request) {
+ th.Mux.HandleFunc("/extensions", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", TokenID)
@@ -34,28 +34,28 @@
fmt.Fprintf(w, `
{
- "extensions": [
- {
- "updated": "2013-01-20T00:00:00-00:00",
- "name": "Neutron Service Type Management",
- "links": [],
- "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0",
- "alias": "service-type",
- "description": "API for retrieving service providers for Neutron advanced services"
- }
- ]
+ "extensions": {
+ "values": [
+ {
+ "updated": "2013-01-20T00:00:00-00:00",
+ "name": "Neutron Service Type Management",
+ "links": [],
+ "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0",
+ "alias": "service-type",
+ "description": "API for retrieving service providers for Neutron advanced services"
+ }
+ ]
+ }
}
- `)
+ `)
})
count := 0
- List(ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ err := List(ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractExtensions(page)
- if err != nil {
- t.Errorf("Failed to extract extensions: %v", err)
- }
+ th.AssertNoErr(t, err)
expected := []Extension{
Extension{
@@ -74,17 +74,15 @@
return true, nil
})
-
- if count != 1 {
- t.Errorf("Expected 1 page, got %d", count)
- }
+ th.AssertNoErr(t, err)
+ th.CheckEquals(t, 1, count)
}
func TestGet(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
- th.Mux.HandleFunc("/v2.0/extensions/agent", func(w http.ResponseWriter, r *http.Request) {
+ th.Mux.HandleFunc("/extensions/agent", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", TokenID)