Feat: file uploading token sign for remote policy

This commit is contained in:
HFO4
2019-12-28 15:50:56 +08:00
parent 132c7a8fcb
commit cf8b5f4d1e
15 changed files with 377 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import (
"github.com/DATA-DOG/go-sqlmock"
model "github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/filesystem/local"
"github.com/HFO4/cloudreve/pkg/filesystem/remote"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"net/http/httptest"
@@ -19,9 +20,17 @@ func TestNewFileSystem(t *testing.T) {
},
}
// 本地 成功
fs, err := NewFileSystem(&user)
asserts.NoError(err)
asserts.NotNil(fs.Handler)
asserts.IsType(local.Handler{}, fs.Handler)
// 远程
user.Policy.Type = "remote"
fs, err = NewFileSystem(&user)
asserts.NoError(err)
asserts.NotNil(fs.Handler)
asserts.IsType(remote.Handler{}, fs.Handler)
user.Policy.Type = "unknown"
fs, err = NewFileSystem(&user)