Fix: test failed due to Policy.AutoName

This commit is contained in:
HFO4 committed 2019-11-19 17:20:59 +08:00
1 parent 88a543ef74
commit 20ea86eaf6
5 files changed
+49 -1

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
package model
import (
"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
"testing"
)
func TestGetFileByPathAndName(t *testing.T) {
asserts := assert.New(t)
fileRows := sqlmock.NewRows([]string{"id", "name"}).
AddRow(1, "1.cia")
mock.ExpectQuery("SELECT(.+)").WillReturnRows(fileRows)
file, _ := GetFileByPathAndName("/", "1.cia", 1)
asserts.Equal("1.cia", file.Name)
asserts.NoError(mock.ExpectationsWereMet())
}