Created
April 16, 2019 21:06
-
-
Save krishbhanushali/69cebb5e24441f891746e8968b38fbf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestGetEntryByIDNotFound(t *testing.T) { | |
req, err := http.NewRequest("GET", "/entry", nil) | |
if err != nil { | |
t.Fatal(err) | |
} | |
q := req.URL.Query() | |
q.Add("id", "123") | |
req.URL.RawQuery = q.Encode() | |
rr := httptest.NewRecorder() | |
handler := http.HandlerFunc(GetEntryByID) | |
handler.ServeHTTP(rr, req) | |
if status := rr.Code; status == http.StatusOK { | |
t.Errorf("handler returned wrong status code: got %v want %v", | |
status, http.StatusBadRequest) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment