diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-03-18 00:38:22 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-03-18 00:38:22 -0400 |
commit | 43be1706be867bc81bb8ac0b77961d63196669af (patch) | |
tree | a579e1b4b4848d8cb7af948eeaa2e8be38ccce53 /dbstore | |
parent | edc0e750d79e1901d480e0408a89fe6f3e27c406 (diff) | |
download | cvez-43be1706be867bc81bb8ac0b77961d63196669af.tar.bz2 cvez-43be1706be867bc81bb8ac0b77961d63196669af.zip |
dbstore/dbstore_test.go: add TestCisaSearch()
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/dbstore_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/dbstore/dbstore_test.go b/dbstore/dbstore_test.go index 524fecb..1f98150 100644 --- a/dbstore/dbstore_test.go +++ b/dbstore/dbstore_test.go @@ -1461,3 +1461,34 @@ func TestAddCisaCatalogs(t *testing.T) { // TODO: TestCisaSearch() // test db: dbstore/testdata/mock-testcisasearch.db // test cases: "wordpad" (1 result), "microsoft excel" (4 results) +func TestCisaSearch(t *testing.T) { + ctx := context.Background() + + tests := []struct { + val string + exp []CisaSearchRow + } {{ + val: "wordpad", + exp: []CisaSearchRow { + CisaSearchRow { + }, + }, + }} + + // connect to test db + db, err := Open("testdata/mock-cisasearch.db") + if err != nil { + t.Error(err) + return + } + + for _, test := range(tests) { + t.Run(test.val, func(t *testing.T) { + if got, err := db.CisaSearch(ctx, test.val); err != nil { + t.Error(err) + } else if !reflect.DeepEqual(got, test.exp) { + t.Errorf("got %v, exp %v", got, test.exp ) + } + }) + } +} |