go fmt
diff --git a/openstack/cdn/v1/base/requests_test.go b/openstack/cdn/v1/base/requests_test.go
index a8d95f9..2c20a71 100644
--- a/openstack/cdn/v1/base/requests_test.go
+++ b/openstack/cdn/v1/base/requests_test.go
@@ -17,18 +17,18 @@
expected := HomeDocument{
"rel/cdn": map[string]interface{}{
- "href-template": "services{?marker,limit}",
- "href-vars": map[string]interface{}{
- "marker": "param/marker",
- "limit": "param/limit",
- },
- "hints": map[string]interface{}{
- "allow": []string{"GET"},
- "formats": map[string]interface{}{
- "application/json": map[string]interface{}{},
- },
- },
- },
+ "href-template": "services{?marker,limit}",
+ "href-vars": map[string]interface{}{
+ "marker": "param/marker",
+ "limit": "param/limit",
+ },
+ "hints": map[string]interface{}{
+ "allow": []string{"GET"},
+ "formats": map[string]interface{}{
+ "application/json": map[string]interface{}{},
+ },
+ },
+ },
}
th.CheckDeepEquals(t, expected, *actual)
}
diff --git a/openstack/cdn/v1/flavors/fixtures.go b/openstack/cdn/v1/flavors/fixtures.go
index f413b6b..d7ec1a0 100644
--- a/openstack/cdn/v1/flavors/fixtures.go
+++ b/openstack/cdn/v1/flavors/fixtures.go
@@ -1,24 +1,24 @@
package flavors
import (
- "fmt"
- "net/http"
- "testing"
+ "fmt"
+ "net/http"
+ "testing"
- th "github.com/rackspace/gophercloud/testhelper"
- fake "github.com/rackspace/gophercloud/testhelper/client"
+ th "github.com/rackspace/gophercloud/testhelper"
+ fake "github.com/rackspace/gophercloud/testhelper/client"
)
// HandleListCDNFlavorsSuccessfully creates an HTTP handler at `/flavors` on the test handler mux
// that responds with a `List` response.
func HandleListCDNFlavorsSuccessfully(t *testing.T) {
- th.Mux.HandleFunc("/flavors", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "GET")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.Mux.HandleFunc("/flavors", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "GET")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, `
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ fmt.Fprintf(w, `
{
"flavors": [
{
@@ -44,19 +44,19 @@
]
}
`)
- })
+ })
}
// HandleGetCDNFlavorSuccessfully creates an HTTP handler at `/flavors/{id}` on the test handler mux
// that responds with a `Get` response.
func HandleGetCDNFlavorSuccessfully(t *testing.T) {
- th.Mux.HandleFunc("/flavors/asia", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "GET")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.Mux.HandleFunc("/flavors/asia", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "GET")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, `
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ fmt.Fprintf(w, `
{
"id" : "asia",
"providers" : [
@@ -78,5 +78,5 @@
]
}
`)
- })
+ })
}
diff --git a/openstack/cdn/v1/flavors/requests_test.go b/openstack/cdn/v1/flavors/requests_test.go
index 7ddf1b1..f731738 100644
--- a/openstack/cdn/v1/flavors/requests_test.go
+++ b/openstack/cdn/v1/flavors/requests_test.go
@@ -1,90 +1,89 @@
package flavors
import (
- "testing"
+ "testing"
- "github.com/rackspace/gophercloud"
- "github.com/rackspace/gophercloud/pagination"
- th "github.com/rackspace/gophercloud/testhelper"
- fake "github.com/rackspace/gophercloud/testhelper/client"
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/pagination"
+ th "github.com/rackspace/gophercloud/testhelper"
+ fake "github.com/rackspace/gophercloud/testhelper/client"
)
func TestList(t *testing.T) {
- th.SetupHTTP()
- defer th.TeardownHTTP()
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
- HandleListCDNFlavorsSuccessfully(t)
+ HandleListCDNFlavorsSuccessfully(t)
- count := 0
+ count := 0
- err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
- count++
- actual, err := ExtractFlavors(page)
- if err != nil {
- t.Errorf("Failed to extract flavors: %v", err)
- return false, err
- }
+ err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+ count++
+ actual, err := ExtractFlavors(page)
+ if err != nil {
+ t.Errorf("Failed to extract flavors: %v", err)
+ return false, err
+ }
- expected := []Flavor{
- Flavor{
- ID: "europe",
- Providers: []Provider{
- Provider{
- Provider: "Fastly",
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://www.fastly.com",
- Rel: "provider_url",
- },
- },
- },
- },
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "https://www.poppycdn.io/v1.0/flavors/europe",
- Rel: "self",
- },
- },
- },
- }
+ expected := []Flavor{
+ Flavor{
+ ID: "europe",
+ Providers: []Provider{
+ Provider{
+ Provider: "Fastly",
+ Links: []gophercloud.Link{
+ gophercloud.Link{
+ Href: "http://www.fastly.com",
+ Rel: "provider_url",
+ },
+ },
+ },
+ },
+ Links: []gophercloud.Link{
+ gophercloud.Link{
+ Href: "https://www.poppycdn.io/v1.0/flavors/europe",
+ Rel: "self",
+ },
+ },
+ },
+ }
- th.CheckDeepEquals(t, expected, actual)
+ th.CheckDeepEquals(t, expected, actual)
- return true, nil
- })
- th.AssertNoErr(t, err)
- th.CheckEquals(t, 1, count)
+ return true, nil
+ })
+ th.AssertNoErr(t, err)
+ th.CheckEquals(t, 1, count)
}
func TestGet(t *testing.T) {
- th.SetupHTTP()
- defer th.TeardownHTTP()
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
- HandleGetCDNFlavorSuccessfully(t)
+ HandleGetCDNFlavorSuccessfully(t)
- expected := &Flavor{
- ID: "asia",
- Providers: []Provider{
- Provider{
- Provider: "ChinaCache",
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "http://www.chinacache.com",
- Rel: "provider_url",
- },
- },
- },
- },
- Links: []gophercloud.Link{
- gophercloud.Link{
- Href: "https://www.poppycdn.io/v1.0/flavors/asia",
- Rel: "self",
- },
- },
- }
+ expected := &Flavor{
+ ID: "asia",
+ Providers: []Provider{
+ Provider{
+ Provider: "ChinaCache",
+ Links: []gophercloud.Link{
+ gophercloud.Link{
+ Href: "http://www.chinacache.com",
+ Rel: "provider_url",
+ },
+ },
+ },
+ },
+ Links: []gophercloud.Link{
+ gophercloud.Link{
+ Href: "https://www.poppycdn.io/v1.0/flavors/asia",
+ Rel: "self",
+ },
+ },
+ }
-
- actual, err := Get(fake.ServiceClient(), "asia").Extract()
- th.AssertNoErr(t, err)
- th.AssertDeepEquals(t, expected, actual)
+ actual, err := Get(fake.ServiceClient(), "asia").Extract()
+ th.AssertNoErr(t, err)
+ th.AssertDeepEquals(t, expected, actual)
}
diff --git a/openstack/cdn/v1/serviceassets/fixtures.go b/openstack/cdn/v1/serviceassets/fixtures.go
index 38e7fc5..5c6b5d0 100644
--- a/openstack/cdn/v1/serviceassets/fixtures.go
+++ b/openstack/cdn/v1/serviceassets/fixtures.go
@@ -1,19 +1,19 @@
package serviceassets
import (
- "net/http"
- "testing"
+ "net/http"
+ "testing"
- th "github.com/rackspace/gophercloud/testhelper"
- fake "github.com/rackspace/gophercloud/testhelper/client"
+ th "github.com/rackspace/gophercloud/testhelper"
+ fake "github.com/rackspace/gophercloud/testhelper/client"
)
// HandleDeleteCDNAssetSuccessfully creates an HTTP handler at `/services/{id}/assets` on the test handler mux
// that responds with a `Delete` response.
func HandleDeleteCDNAssetSuccessfully(t *testing.T) {
- th.Mux.HandleFunc("/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0/assets", func(w http.ResponseWriter, r *http.Request) {
- th.TestMethod(t, r, "DELETE")
- th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
- w.WriteHeader(http.StatusAccepted)
- })
+ th.Mux.HandleFunc("/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0/assets", func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "DELETE")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ w.WriteHeader(http.StatusAccepted)
+ })
}
diff --git a/openstack/cdn/v1/serviceassets/requests_test.go b/openstack/cdn/v1/serviceassets/requests_test.go
index 32896ee..dde7bc1 100644
--- a/openstack/cdn/v1/serviceassets/requests_test.go
+++ b/openstack/cdn/v1/serviceassets/requests_test.go
@@ -1,18 +1,18 @@
package serviceassets
import (
- "testing"
+ "testing"
- th "github.com/rackspace/gophercloud/testhelper"
- fake "github.com/rackspace/gophercloud/testhelper/client"
+ th "github.com/rackspace/gophercloud/testhelper"
+ fake "github.com/rackspace/gophercloud/testhelper/client"
)
func TestDelete(t *testing.T) {
- th.SetupHTTP()
- defer th.TeardownHTTP()
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
- HandleDeleteCDNAssetSuccessfully(t)
+ HandleDeleteCDNAssetSuccessfully(t)
- err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", nil).ExtractErr()
- th.AssertNoErr(t, err)
+ err := Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", nil).ExtractErr()
+ th.AssertNoErr(t, err)
}