mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Test: filesystem/file, filesystem, filesystem/hook, model/file/Create
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -42,3 +43,27 @@ func TestHandler_Put(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandler_Delete(t *testing.T) {
|
||||
asserts := assert.New(t)
|
||||
handler := Handler{}
|
||||
ctx := context.Background()
|
||||
|
||||
file, err := os.Create("test.file")
|
||||
asserts.NoError(err)
|
||||
_ = file.Close()
|
||||
list, err := handler.Delete(ctx, []string{"test.file"})
|
||||
asserts.Equal([]string{"test.file"}, list)
|
||||
asserts.NoError(err)
|
||||
|
||||
file, err = os.Create("test.file")
|
||||
asserts.NoError(err)
|
||||
_ = file.Close()
|
||||
list, err = handler.Delete(ctx, []string{"test.file", "test.notexist"})
|
||||
asserts.Equal([]string{"test.file"}, list)
|
||||
asserts.Error(err)
|
||||
|
||||
list, err = handler.Delete(ctx, []string{"test.notexist"})
|
||||
asserts.Equal([]string{}, list)
|
||||
asserts.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user