2022-01-20 02:35:55 +00:00
|
|
|
package users_test
|
2022-01-19 20:45:53 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2022-01-20 02:35:55 +00:00
|
|
|
"git.t-juice.club/torjus/gpaste/users"
|
2022-01-19 20:45:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestBoltUserStore(t *testing.T) {
|
|
|
|
tmpDir := t.TempDir()
|
2022-01-20 02:35:55 +00:00
|
|
|
newFunc := func() (func(), users.UserStore) {
|
2022-01-19 20:45:53 +00:00
|
|
|
tmpFile := filepath.Join(tmpDir, randomString(8))
|
|
|
|
|
2022-01-20 02:35:55 +00:00
|
|
|
store, err := users.NewBoltUserStore(tmpFile)
|
2022-01-19 20:45:53 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating store: %s", err)
|
|
|
|
}
|
|
|
|
cleanup := func() {
|
|
|
|
store.Close()
|
|
|
|
}
|
|
|
|
return cleanup, store
|
|
|
|
}
|
|
|
|
|
|
|
|
RunUserStoreTest(newFunc, t)
|
|
|
|
|
|
|
|
}
|