summaryrefslogtreecommitdiff
path: root/fs_test.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2022-08-15 00:15:04 +0300
committerMarin Ivanov <[email protected]>2022-08-15 00:15:04 +0300
commitb135dcf644394394e3250188dea39ff4e91f0e06 (patch)
treefa5946e5ee66c39fde185dc145274c4e85d36d51 /fs_test.go
parentde77a507ecfe16a9538b20c66ca075a7f780428b (diff)
Add Fs.Open() and read file test
Diffstat (limited to 'fs_test.go')
-rw-r--r--fs_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs_test.go b/fs_test.go
index f8b7db0..f993849 100644
--- a/fs_test.go
+++ b/fs_test.go
@@ -1,6 +1,7 @@
package s3
import (
+ "io"
"testing"
"time"
@@ -75,6 +76,18 @@ func TestFsStatNoExist(t *testing.T) {
is.Equal(err, afero.ErrFileNotFound)
}
+func TestFsOpenRead(t *testing.T) {
+ is := is.New(t)
+ fs, err := newTestFs()
+ is.NoErr(err)
+ f, err := fs.Open("dir/file")
+ is.NoErr(err)
+ defer f.Close()
+ b, err := io.ReadAll(f)
+ is.NoErr(err)
+ is.Equal(b, []byte("test"))
+}
+
func newTestFs() (*Fs, error) {
fs, err := NewFsFromURL("http://testuser:[email protected]:9000/test-bucket")
return fs, err