INNER CODE UNIT · Go

TestGetDeprecated

kubepug/kubepug · lib/kubepug_test.go:69

func TestGetDeprecated(t *testing.T) {
	ts := httptest.NewServer(
		http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			if r.URL.Path == dataJSON {
				w.Header().Add("Content-Type", "application/json")
				w.WriteHeader(http.StatusOK)
				w.Write([]byte(mock.MockValidData)) //nolint: errcheck
			}
			if r.URL.Path == "/notfound.json" {
				w.WriteHeader(http.StatusNotFound)
			}
		}),
	)
	defer ts.Close()

	t.Run("nil config should fail", func(t *testing.T) {
		pug := &Kubepug{}
		result, err := pug.GetDeprecated()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…