route/internal/database/common_test.go

28 lines
489 B
Go
Raw Normal View History

package database
import (
"testing"
"git.xeserv.us/xena/route/internal/routecrypto"
"github.com/Xe/uuid"
"golang.org/x/net/context"
)
func newTestBoltStorage(t *testing.T) (Storage, string, context.Context, context.CancelFunc) {
k, err := routecrypto.ParseKey(cryptoKey)
if err != nil {
t.Fatal(err)
}
p := uuid.New()
st, err := NewBoltStorage(p, k)
if err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithCancel(context.Background())
return st, p, ctx, cancel
}