Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gohargasparyan authored and boyan-soubachov committed May 3, 2020
1 parent 484fff1 commit 1a43b83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assert/http_assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func TestHttpBody(t *testing.T) {

body := strings.NewReader("I will get this request body back as response!!")
assert.True(HTTPBodyContains(mockT, httpPostHandler, "POST", "/", nil, body, "I will get this request body back as response!!"))
assert.True(HTTPBodyNotContains(mockT, httpPostHandler, "POST", "/", nil, nil, "world"))
}

func TestHttpBodyWrappers(t *testing.T) {
Expand All @@ -180,6 +181,10 @@ func TestHttpBodyWrappers(t *testing.T) {
assert.False(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "Hello, World!"))
assert.False(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "World"))
assert.True(mockAssert.HTTPBodyNotContains(httpGetHelloNameHandler, "GET", "/", url.Values{"name": []string{"World"}}, nil, "world"))

body := strings.NewReader("I will get this request body back as response!!")
assert.True(mockAssert.HTTPBodyContains(httpPostHandler, "POST", "/", nil, body, "I will get this request body back as response!!"))
assert.True(mockAssert.HTTPBodyNotContains(httpPostHandler, "POST", "/", nil, nil, "world"))
}

func httpGetHelloNameHandler(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 1a43b83

Please sign in to comment.