aboutsummaryrefslogtreecommitdiff
path: root/dbstore
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-26 10:06:10 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-26 10:06:10 -0500
commit3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38 (patch)
tree9dd3824ad7f448a96b548f4d43b7639365a28e3b /dbstore
parent681c8377558cec1ed75ee2e59e09582e95040690 (diff)
downloadcvez-3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38.tar.bz2
cvez-3a0b961b0fcbd48cf7a7bd0be41e2cd5752e4f38.zip
dbstore: add dbstore/sqlfs_test.go
Diffstat (limited to 'dbstore')
-rw-r--r--dbstore/dbstore_test.go44
-rw-r--r--dbstore/sqlfs_test.go49
2 files changed, 49 insertions, 44 deletions
diff --git a/dbstore/dbstore_test.go b/dbstore/dbstore_test.go
index 6394035..09093c7 100644
--- a/dbstore/dbstore_test.go
+++ b/dbstore/dbstore_test.go
@@ -261,50 +261,6 @@ func TestInitFail(t *testing.T) {
}
}
-func TestGetQuery(t *testing.T) {
- tests := []struct {
- name string
- val string
- exp bool
- } {
- { "pass", "init", true },
- { "fail", "invalid", false },
- }
-
- for _, test := range(tests) {
- t.Run(test.name, func(t *testing.T) {
- got, err := getQuery(test.val)
- if err != nil && test.exp {
- t.Error(err)
- } else if err == nil && !test.exp {
- t.Errorf("got %v, exp error", got)
- }
- })
- }
-}
-
-func TestGetQueries(t *testing.T) {
- tests := []struct {
- name string
- vals []string
- exp bool
- } {
- { "pass", []string { "init" }, true },
- { "fail", []string { "invalid" }, false },
- }
-
- for _, test := range(tests) {
- t.Run(test.name, func(t *testing.T) {
- got, err := getQueries(test.vals)
- if err != nil && test.exp {
- t.Error(err)
- } else if err == nil && !test.exp {
- t.Errorf("got %v, exp error", got)
- }
- })
- }
-}
-
func TestAddCpeDictionaryPass(t *testing.T) {
if testing.Short() {
t.Skip("skipping TestAddCveFeeds() in short mode")
diff --git a/dbstore/sqlfs_test.go b/dbstore/sqlfs_test.go
new file mode 100644
index 0000000..c8cb345
--- /dev/null
+++ b/dbstore/sqlfs_test.go
@@ -0,0 +1,49 @@
+package dbstore
+
+import (
+ "testing"
+)
+
+func TestGetQuery(t *testing.T) {
+ tests := []struct {
+ name string
+ val string
+ exp bool
+ } {
+ { "pass", "init", true },
+ { "fail", "invalid", false },
+ }
+
+ for _, test := range(tests) {
+ t.Run(test.name, func(t *testing.T) {
+ got, err := getQuery(test.val)
+ if err != nil && test.exp {
+ t.Error(err)
+ } else if err == nil && !test.exp {
+ t.Errorf("got %v, exp error", got)
+ }
+ })
+ }
+}
+
+func TestGetQueries(t *testing.T) {
+ tests := []struct {
+ name string
+ vals []string
+ exp bool
+ } {
+ { "pass", []string { "init" }, true },
+ { "fail", []string { "invalid" }, false },
+ }
+
+ for _, test := range(tests) {
+ t.Run(test.name, func(t *testing.T) {
+ got, err := getQueries(test.vals)
+ if err != nil && test.exp {
+ t.Error(err)
+ } else if err == nil && !test.exp {
+ t.Errorf("got %v, exp error", got)
+ }
+ })
+ }
+}