Change tests for getRequestId to validate against passed value

This commit is contained in:
Héctor Hurtado
2020-09-10 12:41:04 +02:00
parent 66b227e67b
commit 9a78bddcc4
+3 -3
View File
@@ -1171,7 +1171,7 @@ func TestGetRouteIdSetsOctectStreamContentType(t *testing.T) {
} }
} }
func TestGetRouteIdReturnsTheCorrectMethod(t *testing.T) { func TestGetRouteIdReturnsTheCorrectRouteId(t *testing.T) {
h := model.Handler{ h := model.Handler{
Request: httptest.NewRequest("FOO", "/", nil), Request: httptest.NewRequest("FOO", "/", nil),
Writer: httptest.NewRecorder(), Writer: httptest.NewRecorder(),
@@ -1183,8 +1183,8 @@ func TestGetRouteIdReturnsTheCorrectMethod(t *testing.T) {
getRequestId(w, r, &h) getRequestId(w, r, &h)
res := w.Result() res := w.Result()
if body, _ := ioutil.ReadAll(res.Body); string(body) != "Expected_ID" { if body, _ := ioutil.ReadAll(res.Body); string(body) != h.Route.ID {
t.Errorf("Body mismatch. Expected: %q, got: %q", "Expected_ID", string(body)) t.Errorf("Body mismatch. Expected: %q, got: %q", h.Route.ID, string(body))
} }
} }