Skip to content

Commit 6add1ba

Browse files
committed
fix #2158 and more
1 parent 757e7fe commit 6add1ba

File tree

79 files changed

+547
-463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+547
-463
lines changed

_examples/auth/basicauth/basic/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ func TestBasicAuth(t *testing.T) {
1717

1818
// with valid basic auth
1919
e.GET("/admin").WithBasicAuth("myusername", "mypassword").Expect().
20-
Status(httptest.StatusOK).Body().Equal("/admin myusername:mypassword")
20+
Status(httptest.StatusOK).Body().IsEqual("/admin myusername:mypassword")
2121
e.GET("/admin/profile").WithBasicAuth("myusername", "mypassword").Expect().
22-
Status(httptest.StatusOK).Body().Equal("/admin/profile myusername:mypassword")
22+
Status(httptest.StatusOK).Body().IsEqual("/admin/profile myusername:mypassword")
2323
e.GET("/admin/settings").WithBasicAuth("myusername", "mypassword").Expect().
24-
Status(httptest.StatusOK).Body().Equal("/admin/settings myusername:mypassword")
24+
Status(httptest.StatusOK).Body().IsEqual("/admin/settings myusername:mypassword")
2525

2626
// with invalid basic auth
2727
e.GET("/admin/settings").WithBasicAuth("invalidusername", "invalidpassword").

_examples/bootstrapper/main_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ func TestApp(t *testing.T) {
1414
// test our routes
1515
e.GET("/").Expect().Status(httptest.StatusOK)
1616
e.GET("/follower/42").Expect().Status(httptest.StatusOK).
17-
Body().Equal("from /follower/{id:int64} with ID: 42")
17+
Body().IsEqual("from /follower/{id:int64} with ID: 42")
1818
e.GET("/following/52").Expect().Status(httptest.StatusOK).
19-
Body().Equal("from /following/{id:int64} with ID: 52")
19+
Body().IsEqual("from /following/{id:int64} with ID: 52")
2020
e.GET("/like/64").Expect().Status(httptest.StatusOK).
21-
Body().Equal("from /like/{id:int64} with ID: 64")
21+
Body().IsEqual("from /like/{id:int64} with ID: 64")
2222

2323
// test not found
2424
e.GET("/notfound").Expect().Status(httptest.StatusNotFound)
@@ -28,5 +28,5 @@ func TestApp(t *testing.T) {
2828
"message": "",
2929
}
3030
e.GET("/anotfoundwithjson").WithQuery("json", nil).
31-
Expect().Status(httptest.StatusNotFound).JSON().Equal(expectedErr)
31+
Expect().Status(httptest.StatusNotFound).JSON().IsEqual(expectedErr)
3232
}

_examples/cookies/basic/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ func TestCookiesBasic(t *testing.T) {
2020

2121
// Test retrieve a Cookie.
2222
t2 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK)
23-
t2.Body().Equal(cookieValue)
23+
t2.Body().IsEqual(cookieValue)
2424

2525
// Test remove a Cookie.
2626
t3 := e.DELETE(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK)
2727
t3.Body().Contains(cookieName)
2828

2929
t4 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK)
3030
t4.Cookies().Empty()
31-
t4.Body().Empty()
31+
t4.Body().IsEmpty()
3232
}

_examples/cookies/options/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ func TestCookieOptions(t *testing.T) {
2020

2121
// Test retrieve a Cookie.
2222
t2 := e.GET(fmt.Sprintf("/get/%s", cookieName)).Expect().Status(httptest.StatusOK)
23-
t2.Body().Equal(cookieValue)
23+
t2.Body().IsEqual(cookieValue)
2424

2525
// Test remove a Cookie.
2626
t3 := e.GET(fmt.Sprintf("/remove/%s", cookieName)).Expect().Status(httptest.StatusOK)
2727
t3.Body().Contains(fmt.Sprintf("cookie %s removed, value should be empty=%s", cookieName, ""))
2828

2929
t4 := e.GET(fmt.Sprintf("/get/%s", cookieName)).Expect().Status(httptest.StatusOK)
3030
t4.Cookies().Empty()
31-
t4.Body().Empty()
31+
t4.Body().IsEmpty()
3232
}

_examples/cookies/securecookie/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func TestSecureCookie(t *testing.T) {
2222

2323
// Test retrieve a Cookie.
2424
t2 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK)
25-
t2.Body().Equal(cookieValue)
25+
t2.Body().IsEqual(cookieValue)
2626

2727
// Test remove a Cookie.
2828
t3 := e.GET(fmt.Sprintf("/cookies/remove/%s", cookieName)).Expect().Status(httptest.StatusOK)
2929
t3.Body().Contains(cookieName)
3030

3131
t4 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK)
3232
t4.Cookies().Empty()
33-
t4.Body().Empty()
33+
t4.Body().IsEmpty()
3434
}

_examples/dependency-injection/basic/middleware/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ func TestDependencyInjectionBasic_Middleware(t *testing.T) {
1212
e := httptest.New(t, app)
1313
e.POST("/42").WithJSON(testInput{Email: "my_email"}).Expect().
1414
Status(httptest.StatusOK).
15-
JSON().Equal(testOutput{ID: 42, Name: "my_email"})
15+
JSON().IsEqual(testOutput{ID: 42, Name: "my_email"})
1616

1717
// it should stop the execution at the middleware and return the middleware's status code,
1818
// because the error is `ErrStopExecution`.
1919
e.POST("/42").WithJSON(testInput{Email: "invalid"}).Expect().
20-
Status(httptest.StatusAccepted).Body().Empty()
20+
Status(httptest.StatusAccepted).Body().IsEmpty()
2121

2222
// it should stop the execution at the middleware and return the error's text.
2323
e.POST("/42").WithJSON(testInput{Email: "error"}).Expect().
24-
Status(httptest.StatusConflict).Body().Equal("my_error")
24+
Status(httptest.StatusConflict).Body().IsEqual("my_error")
2525
}

_examples/file-server/basic/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestFileServerBasic(t *testing.T) {
8989
e.GET(url).Expect().
9090
Status(httptest.StatusOK).
9191
ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()).
92-
Body().Equal(contents)
92+
Body().IsEqual(contents)
9393
}
9494
}
9595

@@ -109,6 +109,6 @@ func TestHandleDirDot(t *testing.T) {
109109
e.GET(url).Expect().
110110
Status(httptest.StatusOK).
111111
ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()).
112-
Body().Equal(contents)
112+
Body().IsEqual(contents)
113113
}
114114
}

_examples/file-server/embedding-files-into-app-bindata/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ func TestEmbeddingFilesIntoApp(t *testing.T) {
8989
e.GET(url).Expect().
9090
Status(httptest.StatusOK).
9191
ContentType(u.contentType()).
92-
Body().Equal(contents)
92+
Body().IsEqual(contents)
9393
}
9494
}

_examples/file-server/embedding-files-into-app/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ func TestEmbeddingFilesIntoApp(t *testing.T) {
8484
e.GET(url).Expect().
8585
Status(httptest.StatusOK).
8686
ContentType(u.contentType()).
87-
Body().Equal(contents)
87+
Body().IsEqual(contents)
8888
}
8989
}

_examples/file-server/single-page-application/embedded-single-page-application/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestSPAEmbedded(t *testing.T) {
7777
e.GET(url).Expect().
7878
Status(httptest.StatusOK).
7979
ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()).
80-
Body().Equal(contents)
80+
Body().IsEqual(contents)
8181
}
8282

8383
e.GET("/index.html").Expect().Status(httptest.StatusNotFound) // only root is served.

0 commit comments

Comments
 (0)