Skip to content

Commit

Permalink
integration: use http consts for methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Gershman committed Oct 31, 2019
1 parent 397bdd8 commit 316e74b
Show file tree
Hide file tree
Showing 61 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion integration/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = suite("account/get", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = suite("compute/cdn/create", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = suite("compute/cdn/delete", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_flush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = suite("compute/cdn/flush", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/cdn/get", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/cdn/list", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/cdn_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ = suite("compute/cdn/update", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "PUT" {
if req.Method != http.MethodPut {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/certificate_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = suite("compute/certificate/create", func(t *testing.T, when spec.G, it s
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/certificate_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/certificate/delete", func(t *testing.T, when spec.G, it s
return
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/certificate_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = suite("compute/certificate/get", func(t *testing.T, when spec.G, it spec
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/certificate_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/certificate/list", func(t *testing.T, when spec.G, it spe
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/database_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = suite("database/create", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/database_user_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = suite("database/user/create", func(t *testing.T, when spec.G, it spec.S)
w.WriteHeader(http.StatusTeapot)
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/database_user_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = suite("database/user/delete", func(t *testing.T, when spec.G, it spec.S)
w.WriteHeader(http.StatusTeapot)
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/database_user_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = suite("database/user/get", func(t *testing.T, when spec.G, it spec.S) {
w.WriteHeader(http.StatusTeapot)
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/database_user_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = suite("database/user/list", func(t *testing.T, when spec.G, it spec.S) {
w.WriteHeader(http.StatusTeapot)
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_backups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/droplet/backups", func(t *testing.T, when spec.G, it spec
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ = suite("compute/droplet/create", func(t *testing.T, when spec.G, it spec.
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
4 changes: 2 additions & 2 deletions integration/droplet_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ var _ = suite("compute/droplet/delete", func(t *testing.T, when spec.G, it spec.
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}

w.Write([]byte(`{"droplets":[{"name":"some-droplet-name", "id": 1337}]}`))
case "/v2/droplets/1337":
if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var _ = suite("compute/droplet/get", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_kernels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/droplet/kernels", func(t *testing.T, when spec.G, it spec
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/droplet/list", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_neighbors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var _ = suite("compute/droplet/neighbors", func(t *testing.T, when spec.G, it sp
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/droplet_snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/droplet/snapshots", func(t *testing.T, when spec.G, it sp
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
4 changes: 2 additions & 2 deletions integration/droplet_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = suite("compute/droplet/tag", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand All @@ -55,7 +55,7 @@ var _ = suite("compute/droplet/tag", func(t *testing.T, when spec.G, it spec.S)
err = json.Unmarshal(body, &tagRequest)
expect.NoError(err)

if req.Method == "POST" || req.Method == "DELETE" {
if req.Method == http.MethodPost || req.Method == http.MethodDelete {
if tagRequest.Resources[0].ResourceID == "1444" {
w.WriteHeader(http.StatusNotFound)
w.Write([]byte(`{"message": "tag not found"}`))
Expand Down
2 changes: 1 addition & 1 deletion integration/image_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = suite("compute/image/create", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var _ = suite("compute/image/delete", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/image/get", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_list_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/image/list-application", func(t *testing.T, when spec.G,
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_list_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/image/list-distribution", func(t *testing.T, when spec.G,
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/image/list", func(t *testing.T, when spec.G, it spec.S) {
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_list_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/image/list-user", func(t *testing.T, when spec.G, it spec
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/image_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = suite("compute/image/update", func(t *testing.T, when spec.G, it spec.S)
return
}

if req.Method != "PUT" {
if req.Method != http.MethodPut {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
8 changes: 4 additions & 4 deletions integration/kubernetes_clusters_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ var _ = suite("kubernetes/clusters/create", func(t *testing.T, when spec.G, it s
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}

w.Write([]byte(kubeClustersCreateOptResponse))
case "/v2/kubernetes/clusters":
if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand All @@ -56,14 +56,14 @@ var _ = suite("kubernetes/clusters/create", func(t *testing.T, when spec.G, it s

w.Write([]byte(kubeClustersCreateResponse))
case "/v2/kubernetes/clusters/some-cluster-id":
if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}

w.Write([]byte(kubeClustersWaitResponse))
case "/v2/kubernetes/clusters/some-cluster-id/kubeconfig":
if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/lb_add_droplets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/load-balancer/add-droplets", func(t *testing.T, when spec
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/lb_add_forwarding_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = suite("compute/load-balancer/add-forwarding-rules", func(t *testing.T, w
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/lb_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = suite("compute/load-balancer/create", func(t *testing.T, when spec.G, it
return
}

if req.Method != "POST" {
if req.Method != http.MethodPost {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/lb_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ = suite("compute/load-balancer/delete", func(t *testing.T, when spec.G, it
return
}

if req.Method != "DELETE" {
if req.Method != http.MethodDelete {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
2 changes: 1 addition & 1 deletion integration/lb_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ = suite("compute/load-balancer/get", func(t *testing.T, when spec.G, it sp
return
}

if req.Method != "GET" {
if req.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
Expand Down
Loading

0 comments on commit 316e74b

Please sign in to comment.