Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 975761a

Browse files
author
Arran Ubels
committed
Tests were using incorrect structure.
1 parent 431809a commit 975761a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

core/requestv2_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package core_test
33
import (
44
"context"
55
"encoding/base64"
6+
"github.com/onsi/gomega/gstruct"
67
"io/ioutil"
78
"math/rand"
89
"os"
@@ -247,10 +248,10 @@ var _ = Describe("RequestAccessorV2 tests", func() {
247248
})
248249

249250
It("Populates stage variables correctly", func() {
250-
varsRequest := getProxyRequest("orders", "GET")
251+
varsRequest := getProxyRequestV2("orders", "GET")
251252
varsRequest.StageVariables = getStageVariables()
252253

253-
accessor := core.RequestAccessor{}
254+
accessor := core.RequestAccessorV2{}
254255
httpReq, err := accessor.ProxyEventToHTTPRequest(varsRequest)
255256
Expect(err).To(BeNil())
256257

@@ -262,7 +263,7 @@ var _ = Describe("RequestAccessorV2 tests", func() {
262263
Expect("value1").To(Equal(stageVars["var1"]))
263264
Expect("value2").To(Equal(stageVars["var2"]))
264265

265-
stageVars, ok := core.GetStageVarsFromContext(httpReq.Context())
266+
stageVars, ok := core.GetStageVarsFromContextV2(httpReq.Context())
266267
// not present in context
267268
Expect(ok).To(BeFalse())
268269

@@ -273,7 +274,7 @@ var _ = Describe("RequestAccessorV2 tests", func() {
273274
// should not be in headers
274275
Expect(err).ToNot(BeNil())
275276

276-
stageVars, ok = core.GetStageVarsFromContext(httpReq.Context())
277+
stageVars, ok = core.GetStageVarsFromContextV2(httpReq.Context())
277278
Expect(ok).To(BeTrue())
278279
Expect(2).To(Equal(len(stageVars)))
279280
Expect(stageVars["var1"]).ToNot(BeNil())
@@ -284,9 +285,9 @@ var _ = Describe("RequestAccessorV2 tests", func() {
284285

285286
It("Populates the default hostname correctly", func() {
286287

287-
basicRequest := getProxyRequest("orders", "GET")
288-
basicRequest.RequestContext = getRequestContext()
289-
accessor := core.RequestAccessor{}
288+
basicRequest := getProxyRequestV2("orders", "GET")
289+
basicRequest.RequestContext = getRequestContextV2()
290+
accessor := core.RequestAccessorV2{}
290291
httpReq, err := accessor.ProxyEventToHTTPRequest(basicRequest)
291292
Expect(err).To(BeNil())
292293

@@ -297,8 +298,8 @@ var _ = Describe("RequestAccessorV2 tests", func() {
297298
It("Uses a custom hostname", func() {
298299
myCustomHost := "http://my-custom-host.com"
299300
os.Setenv(core.CustomHostVariable, myCustomHost)
300-
basicRequest := getProxyRequest("orders", "GET")
301-
accessor := core.RequestAccessor{}
301+
basicRequest := getProxyRequestV2("orders", "GET")
302+
accessor := core.RequestAccessorV2{}
302303
httpReq, err := accessor.EventToRequestWithContext(context.Background(), basicRequest)
303304
Expect(err).To(BeNil())
304305

@@ -310,8 +311,8 @@ var _ = Describe("RequestAccessorV2 tests", func() {
310311
It("Strips terminating / from hostname", func() {
311312
myCustomHost := "http://my-custom-host.com"
312313
os.Setenv(core.CustomHostVariable, myCustomHost+"/")
313-
basicRequest := getProxyRequest("orders", "GET")
314-
accessor := core.RequestAccessor{}
314+
basicRequest := getProxyRequestV2("orders", "GET")
315+
accessor := core.RequestAccessorV2{}
315316
httpReq, err := accessor.EventToRequestWithContext(context.Background(), basicRequest)
316317
Expect(err).To(BeNil())
317318

0 commit comments

Comments
 (0)