Fix tests style

This commit is contained in:
Filip Figiel 2018-08-17 09:33:22 +02:00
parent 5c704908d8
commit f01951917b
2 changed files with 6 additions and 6 deletions

View File

@ -575,9 +575,9 @@ func TestContextRenderJSON(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
c, _ := CreateTestContext(w) c, _ := CreateTestContext(w)
c.JSON(http.StatusCreated, H{"foo": "bar", "html": "<b>"}) c.JSON(201, H{"foo": "bar", "html": "<b>"})
assert.Equal(t, http.StatusCreated, w.Code) assert.Equal(t, 201, w.Code)
assert.Equal( assert.Equal(
t, t,
"{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n", "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n",
@ -591,7 +591,7 @@ func TestContextRenderJSON(t *testing.T) {
func TestContextRenderPureJSON(t *testing.T) { func TestContextRenderPureJSON(t *testing.T) {
c, w, _ := CreateTestContext() c, w, _ := CreateTestContext()
c.PureJSON(201, H{"foo": "bar", "html": "<b>"}) c.PureJSON(201, H{"foo": "bar", "html": "<b>"})
assert.Equal(t, w.Code, 201) assert.Equal(t, 201, w.Code)
assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String()) assert.Equal(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String())
assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type")) assert.Equal(t, "application/json; charset=utf-8", w.HeaderMap.Get("Content-Type"))
} }

View File

@ -52,9 +52,9 @@ func TestRenderJSON(t *testing.T) {
assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String()) assert.Equal(t, "{\"foo\":\"bar\"}", w.Body.String())
assert.Equal( assert.Equal(
t, t,
w.Body.String(), "{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n",
"{\"foo\":\"bar\",\"html\":\"\\u003cb\\u003e\"}\n") w.Body.String())
assert.Equal(t, w.Header().Get("Content-Type"), "application/json; charset=utf-8") assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type"))
} }
func TestRenderPureJSON(t *testing.T) { func TestRenderPureJSON(t *testing.T) {