From 89b183dcf4e0f3fa4ff171f1783373f2c6e14ec9 Mon Sep 17 00:00:00 2001 From: Kiril Kabakchiev Date: Mon, 4 Feb 2019 15:39:33 +0200 Subject: [PATCH] Broker API response now returns "service_brokers" instead of "brokers" (#223) --- pkg/types/broker.go | 2 +- test/broker_test/broker_test.go | 2 +- test/common/common.go | 2 +- test/delete_list.go | 5 ----- test/list.go | 4 ---- 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pkg/types/broker.go b/pkg/types/broker.go index 1e3cab762..6977a492b 100644 --- a/pkg/types/broker.go +++ b/pkg/types/broker.go @@ -28,7 +28,7 @@ import ( // Brokers struct type Brokers struct { - Brokers []*Broker `json:"brokers"` + Brokers []*Broker `json:"service_brokers"` } // Broker broker struct diff --git a/test/broker_test/broker_test.go b/test/broker_test/broker_test.go index 627bc089d..b54dbf9f0 100644 --- a/test/broker_test/broker_test.go +++ b/test/broker_test/broker_test.go @@ -771,7 +771,7 @@ var _ = test.DescribeTestsFor(test.TestCase{ ctx.SMWithOAuth.GET("/v1/service_brokers"). Expect(). Status(http.StatusOK). - JSON().Object().Value("brokers").Array().First().Object(). + JSON().Object().Value("service_brokers").Array().First().Object(). ContainsMap(expectedBrokerResponse) assertInvocationCount(brokerServer.CatalogEndpointRequests, 1) diff --git a/test/common/common.go b/test/common/common.go index 622b54ef8..88a95f535 100644 --- a/test/common/common.go +++ b/test/common/common.go @@ -188,7 +188,7 @@ func MapContains(actual Object, expected Object) { } func RemoveAllBrokers(SM *httpexpect.Expect) { - removeAll(SM, "brokers", "/v1/service_brokers") + removeAll(SM, "service_brokers", "/v1/service_brokers") } func RemoveAllPlatforms(SM *httpexpect.Expect) { diff --git a/test/delete_list.go b/test/delete_list.go index 41fb984fc..87a782246 100644 --- a/test/delete_list.go +++ b/test/delete_list.go @@ -285,12 +285,7 @@ func DescribeDeleteListFor(ctx *common.TestContext, t TestCase) bool { } verifyDeleteListOpHelper := func(deleteListOpEntry deleteOpEntry, query string) { - - // workaround for brokers api jsonArrayKey := strings.Replace(t.API, "/v1/", "", 1) - if jsonArrayKey == "service_brokers" { - jsonArrayKey = "brokers" - } expectedAfterOpIDs := make([]string, 0) unexpectedAfterOpIDs := make([]string, 0) diff --git a/test/list.go b/test/list.go index 296519a36..31eb23ab0 100644 --- a/test/list.go +++ b/test/list.go @@ -273,11 +273,7 @@ func DescribeListTestsFor(ctx *common.TestContext, t TestCase) bool { expectedAfterOpIDs = common.ExtractResourceIDs(listOpEntry.resourcesToExpectAfterOp) unexpectedAfterOpIDs = common.ExtractResourceIDs(listOpEntry.resourcesNotToExpectAfterOp) - // workaround for brokers api jsonArrayKey := strings.Replace(t.API, "/v1/", "", 1) - if jsonArrayKey == "service_brokers" { - jsonArrayKey = "brokers" - } By(fmt.Sprintf("[TEST]: Verifying expected %s before operation after present", t.API)) beforeOpArray := ctx.SMWithOAuth.GET(t.API).