Skip to content

Instantly share code, notes, and snippets.

@quii
Last active August 29, 2015 14:17
Show Gist options
  • Save quii/6520d1eb85574d814bb3 to your computer and use it in GitHub Desktop.
Save quii/6520d1eb85574d814bb3 to your computer and use it in GitHub Desktop.
func Test_it_handles_non_ok_from_hello_api(t *testing.T) {
helloAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "oops", http.StatusInternalServerError)
}))
worldAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "world")
}))
result := Stitcher(helloAPI.URL, worldAPI.URL)
if result != errorMsg {
t.Errorf("Stitcher didnt fail properly, expected [%s], got [%s]", errorMsg, result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment