X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/00d1ef67636df59460bd4e060f6da4b0c9bcb24c..90606c7524caa82180dad8f2ce613f1c07385b29:/hotline/file_store.go?ds=sidebyside diff --git a/hotline/file_store.go b/hotline/file_store.go index 81c1f05..b56d9a1 100644 --- a/hotline/file_store.go +++ b/hotline/file_store.go @@ -9,10 +9,9 @@ var FS FileStore type FileStore interface { Mkdir(name string, perm os.FileMode) error - Stat(name string) (os.FileInfo, error) - // TODO: implement - + Open(name string) (*os.File, error) + // TODO: implement these //Rename(oldpath string, newpath string) error //RemoveAll(path string) error } @@ -27,6 +26,10 @@ func (fs OSFileStore) Stat(name string) (os.FileInfo, error) { return os.Stat(name) } +func (fs OSFileStore) Open(name string) (*os.File, error) { + return os.Open(name) +} + type MockFileStore struct { mock.Mock } @@ -38,9 +41,14 @@ func (mfs MockFileStore) Mkdir(name string, perm os.FileMode) error { func (mfs MockFileStore) Stat(name string) (os.FileInfo, error) { args := mfs.Called(name) - if args.Get(0) == nil { + if args.Get(0) == nil { return nil, args.Error(1) } return args.Get(0).(os.FileInfo), args.Error(1) } + +func (mfs MockFileStore) Open(name string) (*os.File, error) { + args := mfs.Called(name) + return args.Get(0).(*os.File), args.Error(1) +}