MCPcopy
hub / github.com/basecamp/once / TestVerifyHTTP_RedirectToSuccess

Function TestVerifyHTTP_RedirectToSuccess

internal/docker/application_test.go:30–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestVerifyHTTP_RedirectToSuccess(t *testing.T) {
31 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
32 if r.URL.Path == "/" {
33 http.Redirect(w, r, "/home", http.StatusFound)
34 return
35 }
36 w.WriteHeader(http.StatusOK)
37 }))
38 defer server.Close()
39
40 app := &Application{
41 Settings: ApplicationSettings{Host: server.Listener.Addr().String(), DisableTLS: true},
42 }
43
44 err := app.verifyHTTP(context.Background())
45 assert.NoError(t, err)
46}
47
48func TestVerifyHTTP_ServerError(t *testing.T) {
49 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 3

verifyHTTPMethod · 0.95
WriteHeaderMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…