aboutsummaryrefslogtreecommitdiff
path: root/hotline/file_store.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-02 15:22:11 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-02 15:22:11 -0700
commit481631f6b541a0f00c7c3ba789c13ac934bdefbc (patch)
tree7e672f439c1d9a93f68493d5da624e17bd0ce654 /hotline/file_store.go
parent5ae5087660f0855087a2a65181d000d4383a45f4 (diff)
Cleanup and backfill tests
Diffstat (limited to 'hotline/file_store.go')
-rw-r--r--hotline/file_store.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/hotline/file_store.go b/hotline/file_store.go
index ed0ffa4..ba86c6a 100644
--- a/hotline/file_store.go
+++ b/hotline/file_store.go
@@ -2,6 +2,7 @@ package hotline
import (
"github.com/stretchr/testify/mock"
+ "io/fs"
"os"
)
@@ -14,6 +15,7 @@ type FileStore interface {
Symlink(oldname, newname string) error
Remove(name string) error
Create(name string) (*os.File, error)
+ WriteFile(name string, data []byte, perm fs.FileMode) error
// TODO: implement these
// Rename(oldpath string, newpath string) error
// RemoveAll(path string) error
@@ -45,6 +47,10 @@ func (fs *OSFileStore) Create(name string) (*os.File, error) {
return os.Create(name)
}
+func (fs *OSFileStore) WriteFile(name string, data []byte, perm fs.FileMode) error {
+ return os.WriteFile(name, data, perm)
+}
+
type MockFileStore struct {
mock.Mock
}
@@ -82,3 +88,8 @@ func (mfs *MockFileStore) Create(name string) (*os.File, error) {
args := mfs.Called(name)
return args.Get(0).(*os.File), args.Error(1)
}
+
+func (mfs *MockFileStore) WriteFile(name string, data []byte, perm fs.FileMode) error {
+ args := mfs.Called(name, data, perm)
+ return args.Error(0)
+}