diff options
Diffstat (limited to 'pkg/datamaps/config_test.go')
-rw-r--r-- | pkg/datamaps/config_test.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/pkg/datamaps/config_test.go b/pkg/datamaps/config_test.go deleted file mode 100644 index dadaf6d..0000000 --- a/pkg/datamaps/config_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package datamaps - -import ( - "os" - "path/filepath" - "testing" -) - -// mocking funcs in go https://stackoverflow.com/questions/19167970/mock-functions-in-go - -func mockConfigDir() (string, error) { - return "/tmp/CONFIG/datamaps/", nil -} - -func TestDBDetect(t *testing.T) { - - cPath := filepath.Join("/tmp", "CONFIG", "datamaps") - t.Logf("%s\n", cPath) - if err := os.MkdirAll(cPath, 0700); err != nil { - t.Fatalf("cannot create temporary directory - %v", err) - } - - if _, err := os.Create(filepath.Join("/tmp", "CONFIG", "datamaps", "datamaps.db")); err != nil { - t.Fatalf("cannot open '/tmp/CONFIG/datamaps/databamps.db': %v", err) - } - defer func() { - os.RemoveAll(filepath.Join("/tmp", "CONFIG")) - }() - - dbpc := NewDBPathChecker(mockConfigDir) - h := dbpc.Check() - if !h { - t.Error("the db file should be found but isn't") - } -} |