Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
297fc8d5
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
297fc8d5
编写于
3月 12, 2020
作者:
H
HFO4
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: failed test due to relative path
上级
71876a79
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
12 deletion
+8
-12
pkg/filesystem/file_test.go
pkg/filesystem/file_test.go
+4
-5
pkg/filesystem/manage_test.go
pkg/filesystem/manage_test.go
+3
-2
pkg/filesystem/upload_test.go
pkg/filesystem/upload_test.go
+1
-0
pkg/filesystem/validator_test.go
pkg/filesystem/validator_test.go
+0
-5
未找到文件。
pkg/filesystem/file_test.go
浏览文件 @
297fc8d5
...
...
@@ -501,7 +501,8 @@ func TestFileSystem_Preview(t *testing.T) {
}
fs
.
FileTarget
=
[]
model
.
File
{
{
PolicyID
:
1
,
SourceName
:
"tests/no.txt"
,
PolicyID
:
1
,
Policy
:
model
.
Policy
{
Model
:
gorm
.
Model
{
ID
:
1
},
Type
:
"local"
,
...
...
@@ -529,10 +530,8 @@ func TestFileSystem_Preview(t *testing.T) {
},
}
resp
,
err
:=
fs
.
Preview
(
ctx
,
1
,
false
)
asserts
.
NoError
(
err
)
asserts
.
NotNil
(
resp
)
asserts
.
False
(
resp
.
Redirect
)
asserts
.
NoError
(
resp
.
Content
.
Close
())
asserts
.
Error
(
err
)
asserts
.
Nil
(
resp
)
}
// 需要重定向,成功
...
...
pkg/filesystem/manage_test.go
浏览文件 @
297fc8d5
...
...
@@ -9,6 +9,7 @@ import (
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/pkg/filesystem/fsctx"
"github.com/HFO4/cloudreve/pkg/serializer"
"github.com/HFO4/cloudreve/pkg/util"
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"
"os"
...
...
@@ -350,8 +351,8 @@ func TestFileSystem_Delete(t *testing.T) {
//全部成功
{
fs
.
CleanTargets
()
file
,
err
:=
os
.
Create
(
"1.txt"
)
file2
,
err
:=
os
.
Create
(
"2.txt"
)
file
,
err
:=
os
.
Create
(
util
.
RelativePath
(
"1.txt"
)
)
file2
,
err
:=
os
.
Create
(
util
.
RelativePath
(
"2.txt"
)
)
file
.
Close
()
file2
.
Close
()
asserts
.
NoError
(
err
)
...
...
pkg/filesystem/upload_test.go
浏览文件 @
297fc8d5
...
...
@@ -112,6 +112,7 @@ func TestFileSystem_Upload(t *testing.T) {
Size
:
5
,
VirtualPath
:
"/"
,
Name
:
"1.txt"
,
File
:
ioutil
.
NopCloser
(
strings
.
NewReader
(
""
)),
}
err
=
fs
.
Upload
(
ctx
,
file
)
asserts
.
NoError
(
err
)
...
...
pkg/filesystem/validator_test.go
浏览文件 @
297fc8d5
...
...
@@ -61,11 +61,6 @@ func TestFileSystem_ValidateCapacity(t *testing.T) {
fs
.
User
.
Storage
=
5
asserts
.
False
(
fs
.
ValidateCapacity
(
ctx
,
10
))
asserts
.
Equal
(
uint64
(
5
),
fs
.
User
.
Storage
)
fs
.
User
.
Storage
=
5
cache
.
Set
(
"pack_size_0"
,
uint64
(
15
),
0
)
asserts
.
True
(
fs
.
ValidateCapacity
(
ctx
,
10
))
asserts
.
Equal
(
uint64
(
15
),
fs
.
User
.
Storage
)
}
func
TestFileSystem_ValidateFileSize
(
t
*
testing
.
T
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录