func TestResponseBufferWriteTo(t *testing.T) { rec, req := helper.NewTestRequest("GET", "/") buf := NewBuffer(rec) write("hi").ServeHTTP(buf, req) buf.FlushAll() err := helper.AssertResponse(rec, "hi", 200) if err != nil { t.Error(err) } }
func TestResponseBufferWriteToStatus(t *testing.T) { rec, req := helper.NewTestRequest("GET", "/") buf := NewBuffer(rec) http.NotFoundHandler().ServeHTTP(buf, req) buf.FlushAll() err := helper.AssertResponse(rec, "404 page not found", 404) if err != nil { t.Error(err) } if buf.IsOk() { t.Error("buf is ok, but should be not") } }