invalid cookie url

This commit is contained in:
César Gallego Rodríguez
2019-10-10 17:11:40 +02:00
parent 9ed75d14a9
commit 738f371203
+22
View File
@@ -115,6 +115,28 @@ func TestUpdateResourceOkWhenValidHandlerID(t *testing.T) {
}
}
func TestUpdateResourceBadRequestWhenInvalidCookiesUrl(t *testing.T) {
t.Skip("**** WIP ****")
request := httptest.NewRequest(http.MethodPut, "/handlers/HANDLER_YYYYYYYYYYYYYYYY/response/cookies", strings.NewReader("value"))
response := httptest.NewRecorder()
handler := mux.NewRouter()
handler.HandleFunc("/handlers/{handler_id}/{resource:.*$}", updateResource).
Methods("PUT")
getHandlerId = func(id string) (*model.Handler, bool) {
if id == "HANDLER_YYYYYYYYYYYYYYYY" {
return nil, true
}
return nil, false
}
handler.ServeHTTP(response, request)
if response.Code != http.StatusBadRequest {
t.Errorf("HTTP Status mismatch. Expected: %d, got: %d", http.StatusBadRequest, response.Code)
}
}
// FIXME: Fails because URL doesn't match
//func TestUpdateResourceNotFoundWhenInvalidHandlerID(t *testing.T) {
// request := httptest.NewRequest(http.MethodPut, "/handlers/response/headers/language", strings.NewReader("ES"))