提交 8d9dee6e 编写于 作者: H HFO4

Test: migration modifications

上级 a8272a66
......@@ -144,7 +144,6 @@ Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; verti
{Name: "defaultTheme", Value: `#3f51b5`, Type: "basic"},
{Name: "themes", Value: `{"#3f51b5":{"palette":{"primary":{"main":"#3f51b5"},"secondary":{"main":"#f50057"}}},"#2196f3":{"palette":{"primary":{"main":"#2196f3"},"secondary":{"main":"#FFC107"}}},"#673AB7":{"palette":{"primary":{"main":"#673AB7"},"secondary":{"main":"#2196F3"}}},"#E91E63":{"palette":{"primary":{"main":"#E91E63"},"secondary":{"main":"#42A5F5","contrastText":"#fff"}}},"#FF5722":{"palette":{"primary":{"main":"#FF5722"},"secondary":{"main":"#3F51B5"}}},"#FFC107":{"palette":{"primary":{"main":"#FFC107"},"secondary":{"main":"#26C6DA"}}},"#8BC34A":{"palette":{"primary":{"main":"#8BC34A","contrastText":"#fff"},"secondary":{"main":"#FF8A65","contrastText":"#fff"}}},"#009688":{"palette":{"primary":{"main":"#009688"},"secondary":{"main":"#4DD0E1","contrastText":"#fff"}}},"#607D8B":{"palette":{"primary":{"main":"#607D8B"},"secondary":{"main":"#F06292"}}},"#795548":{"palette":{"primary":{"main":"#795548"},"secondary":{"main":"#4CAF50","contrastText":"#fff"}}}}`, Type: "basic"},
{Name: "aria2_token", Value: `your token`, Type: "aria2"},
{Name: "aria2_token", Value: `your token`, Type: "aria2"},
{Name: "aria2_temp_path", Value: ``, Type: "aria2"},
{Name: "aria2_options", Value: `[]`, Type: "aria2"},
{Name: "aria2_interval", Value: `10`, Type: "aria2"},
......
......@@ -150,7 +150,7 @@ func TestNewUser(t *testing.T) {
asserts := assert.New(t)
newUser := NewUser()
asserts.IsType(User{}, newUser)
asserts.NotEmpty(newUser.Avatar)
asserts.Empty(newUser.Avatar)
}
func TestUser_AfterFind(t *testing.T) {
......
package conf
import (
"github.com/HFO4/cloudreve/pkg/util"
"github.com/stretchr/testify/assert"
"io/ioutil"
"os"
......@@ -12,10 +13,12 @@ func TestInitPanic(t *testing.T) {
asserts := assert.New(t)
// 日志路径不存在时
asserts.Panics(func() {
asserts.NotPanics(func() {
Init("not/exist/path")
})
asserts.True(util.Exists("conf.ini"))
}
// TestInitDelimiterNotFound 日志路径存在但 Key 格式错误时
......
package conf
import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"os"
"testing"
)
func TestWriteVersionLock(t *testing.T) {
asserts := assert.New(t)
// 清理残余文件
if _, err := os.Stat("version.lock"); !os.IsNotExist(err) {
err = os.Remove("version.lock")
asserts.NoError(err)
}
err := WriteVersionLock()
defer func() { err = os.Remove("version.lock") }()
writtenVersion, err := ioutil.ReadFile("version.lock")
// 写入的版本应与当前版本相同
asserts.NoError(err)
asserts.Equal(string(writtenVersion), BackendVersion)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册