Fix: failed unit tests

This commit is contained in:
HFO4 2019-12-05 19:10:55 +08:00
parent 5df8f688d1
commit 13fb090194
2 changed files with 3 additions and 5 deletions

View file

@ -16,7 +16,7 @@ func TestFileStream_GetFileName(t *testing.T) {
func TestFileStream_GetMIMEType(t *testing.T) { func TestFileStream_GetMIMEType(t *testing.T) {
asserts := assert.New(t) asserts := assert.New(t)
file := FileStream{MIMEType: "123"} file := FileStream{MIMEType: "123"}
asserts.Equal("123", file.GetFileName()) asserts.Equal("123", file.GetMIMEType())
} }
func TestFileStream_GetSize(t *testing.T) { func TestFileStream_GetSize(t *testing.T) {

View file

@ -408,6 +408,7 @@ func TestFileSystem_Copy(t *testing.T) {
} }
func TestFileSystem_Move(t *testing.T) { func TestFileSystem_Move(t *testing.T) {
conf.DatabaseConfig.Type = "mysql"
asserts := assert.New(t) asserts := assert.New(t)
fs := &FileSystem{User: &model.User{ fs := &FileSystem{User: &model.User{
Model: gorm.Model{ Model: gorm.Model{
@ -420,10 +421,7 @@ func TestFileSystem_Move(t *testing.T) {
// 目录不存在 // 目录不存在
{ {
mock.ExpectQuery("SELECT(.+)").WithArgs(uint(1), "/dst").WillReturnRows( mock.ExpectQuery("SELECT(.+)").WillReturnRows(
sqlmock.NewRows([]string{"name"}),
)
mock.ExpectQuery("SELECT(.+)").WithArgs(uint(1), "/src").WillReturnRows(
sqlmock.NewRows([]string{"name"}), sqlmock.NewRows([]string{"name"}),
) )
err := fs.Move(ctx, []string{}, []string{}, "/src", "/dst") err := fs.Move(ctx, []string{}, []string{}, "/src", "/dst")