2022-01-20 02:40:32 +00:00
|
|
|
package files_test
|
2022-01-19 00:03:24 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-01-20 02:40:32 +00:00
|
|
|
"git.t-juice.club/torjus/gpaste/files"
|
2022-01-19 00:03:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFSFileStore(t *testing.T) {
|
|
|
|
dir := t.TempDir()
|
2022-01-20 02:40:32 +00:00
|
|
|
s, err := files.NewFSFileStore(dir)
|
2022-01-19 00:03:24 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating store: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
RunFilestoreTest(s, t)
|
2022-01-19 02:10:50 +00:00
|
|
|
persistentDir := t.TempDir()
|
2022-01-20 02:40:32 +00:00
|
|
|
newFunc := func() files.FileStore {
|
|
|
|
s, err := files.NewFSFileStore(persistentDir)
|
2022-01-19 02:10:50 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating store: %s", err)
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
RunPersistentFilestoreTest(newFunc, t)
|
2022-01-19 00:03:24 +00:00
|
|
|
}
|