Commit 64ccf633 authored by Geoff Simmons's avatar Geoff Simmons

REST API: test GET v1/pems with empty response

parent 09965460
......@@ -309,6 +309,22 @@ func TestAllPems(t *testing.T) {
t.Errorf("HEAD /v1/pems Content-Type: got %s want %s",
rr.Header().Get("Content-Type"), jsonContentType)
}
delete(files.Files, "ns1/cafe")
delete(files.Files, "ns2/bar")
req = httptest.NewRequest(http.MethodGet, "/v1/pems", nil)
rr = httptest.NewRecorder()
hndlr.ServeHTTP(rr, req)
if rr.Code != http.StatusOK {
t.Errorf("GET /v1/pems status: got %d want %d", rr.Code,
http.StatusOK)
}
if err = json.Unmarshal(rr.Body.Bytes(), &allInfo); err != nil {
t.Errorf("GET /v1/pems unmarshal: %v", err)
}
if len(allInfo) != 0 {
t.Fatalf("GET /v1/pems len(slice) got %d want 0", len(allInfo))
}
}
func TestAllPems405(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment