package daemon import ( "context" "net/http" "net/http/httptest" "testing" ) func TestServiceListUnsupportedMethods(t *testing.T) { for _, method := range []string{http.MethodGet, http.MethodPut, http.MethodHead} { t.Run(method, func(t *testing.T) { req := httptest.NewRequest(method, "/service", nil) resp := httptest.NewRecorder() ServiceList(resp, req, context.Background()) response := resp.Result() if response.StatusCode != 501 { t.Errorf("Expected status 501, got %d.", response.StatusCode) } }) } }