From f41a4315950e9c7cac7da295f5461450e37c62bb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 17 Apr 2018 14:31:00 -0700 Subject: [PATCH] importer: add test that fails at Go tip Updates #1090 Change-Id: I16ee3cfd49ba9af2b98cdef470932ca000d768dc --- pkg/importer/importer_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/importer/importer_test.go b/pkg/importer/importer_test.go index 1f578b139..93ece9b4b 100644 --- a/pkg/importer/importer_test.go +++ b/pkg/importer/importer_test.go @@ -17,6 +17,8 @@ limitations under the License. package importer import ( + "net/http/httptest" + "strings" "testing" "go4.org/jsonconfig" @@ -64,3 +66,16 @@ func TestStaticConfig(t *testing.T) { t.Errorf("expected error from secret without id") } } + +func TestImportRootPageHTML(t *testing.T) { + h, err := NewHost(HostConfig{}) + if err != nil { + t.Fatal(err) + } + w := httptest.NewRecorder() + r := httptest.NewRequest("GET", "/importer/", nil) + h.serveImportersRoot(w, r) + if w.Code != 200 || !strings.Contains(w.Body.String(), "dummy1") { + t.Errorf("Got %d response with header %v, body %s", w.Code, w.HeaderMap, w.Body.String()) + } +}