From d7213b51b573ff5e7c7d4c647cedc522721345d0 Mon Sep 17 00:00:00 2001 From: Ilya Glotov Date: Fri, 25 May 2018 19:04:52 +0300 Subject: [PATCH] Add list analyzers by type test --- analyzer_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/analyzer_test.go b/analyzer_test.go index 71242c5..8f584ed 100644 --- a/analyzer_test.go +++ b/analyzer_test.go @@ -25,6 +25,26 @@ func TestListAnalyzers(t *testing.T) { } } +func TestListByTypeAnalyzers(t *testing.T) { + client, mux, _, closer := setup() + defer closer() + + mux.HandleFunc("/"+analyzersByType+analyzerType, func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write(analyzersJSON) + }) + + got, _, err := client.Analyzers.ListByType(context.Background(), analyzerType) + if err != nil { + t.Errorf("Analyzer.ListByType returned error: %v", err) + } + if want := wantList; !reflect.DeepEqual(got, want) { + t.Errorf("Analyzer.ListByType = %+v, want %+v", got, want) + } +} + +var analyzerType = "ip" + var analyzersJSON = []byte(` [ {