2021-12-04 08:58:16 +00:00
|
|
|
package store_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"gitea.benny.dog/torjus/ezshare/store"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBoltStore(t *testing.T) {
|
|
|
|
path := filepath.Join(t.TempDir(), "boltstore.db")
|
|
|
|
s, err := store.NewBoltStore(path)
|
2021-12-05 10:08:09 +00:00
|
|
|
defer s.Close()
|
2021-12-04 08:58:16 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error opening store: %s", err)
|
|
|
|
}
|
|
|
|
doFileStoreTest(s, t)
|
2021-12-05 00:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBoltCertificateStore(t *testing.T) {
|
|
|
|
path := filepath.Join(t.TempDir(), "boltstore.db")
|
|
|
|
s, err := store.NewBoltStore(path)
|
2021-12-05 10:08:09 +00:00
|
|
|
defer s.Close()
|
2021-12-05 00:00:32 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error opening store: %s", err)
|
|
|
|
}
|
|
|
|
doCertificateStoreTest(s, t)
|
2021-12-05 10:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBoltUserStore(t *testing.T) {
|
|
|
|
path := filepath.Join(t.TempDir(), "boltstore.db")
|
|
|
|
s, err := store.NewBoltStore(path)
|
|
|
|
defer s.Close()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error opening store: %s", err)
|
|
|
|
}
|
|
|
|
doUserStoreTests(s, t)
|
2021-12-04 08:58:16 +00:00
|
|
|
}
|