aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-03-18 00:38:22 -0400
committerPaul Duncan <pabs@pablotron.org>2022-03-18 00:38:22 -0400
commit43be1706be867bc81bb8ac0b77961d63196669af (patch)
treea579e1b4b4848d8cb7af948eeaa2e8be38ccce53
parentedc0e750d79e1901d480e0408a89fe6f3e27c406 (diff)
downloadcvez-43be1706be867bc81bb8ac0b77961d63196669af.tar.bz2
cvez-43be1706be867bc81bb8ac0b77961d63196669af.zip
dbstore/dbstore_test.go: add TestCisaSearch()
-rw-r--r--dbstore/dbstore_test.go31
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 )
+ }
+ })
+ }
+}