test: fix failed test related to Folder.Create
This commit is contained in:
@@ -117,11 +117,9 @@ func TestGenericAfterUpload(t *testing.T) {
|
||||
WithArgs(1, "我的文件").
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}))
|
||||
// 1
|
||||
mock.ExpectBegin()
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs("我的文件", 1, 1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}).AddRow(2, 1))
|
||||
mock.ExpectCommit()
|
||||
mock.ExpectQuery("SELECT(.+)files(.+)").WillReturnError(errors.New("not found"))
|
||||
mock.ExpectBegin()
|
||||
mock.ExpectExec("INSERT(.+)files(.+)").WillReturnResult(sqlmock.NewResult(1, 1))
|
||||
@@ -140,11 +138,9 @@ func TestGenericAfterUpload(t *testing.T) {
|
||||
WithArgs(1, "我的文件").
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}))
|
||||
// 1
|
||||
mock.ExpectBegin()
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs("我的文件", 1, 1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}).AddRow(2, 1))
|
||||
mock.ExpectCommit()
|
||||
mock.ExpectQuery("SELECT(.+)files(.+)").WillReturnRows(
|
||||
mock.NewRows([]string{"name"}).AddRow("test.txt"),
|
||||
)
|
||||
@@ -160,11 +156,9 @@ func TestGenericAfterUpload(t *testing.T) {
|
||||
WithArgs(1, "我的文件").
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}))
|
||||
// 1
|
||||
mock.ExpectBegin()
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs("我的文件", 1, 1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}).AddRow(2, 1))
|
||||
mock.ExpectCommit()
|
||||
mock.ExpectQuery("SELECT(.+)files(.+)").WillReturnRows(
|
||||
mock.NewRows([]string{"name", "upload_session_id"}).AddRow("test.txt", "1"),
|
||||
)
|
||||
@@ -180,11 +174,9 @@ func TestGenericAfterUpload(t *testing.T) {
|
||||
WithArgs(1, "我的文件").
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}))
|
||||
// 1
|
||||
mock.ExpectBegin()
|
||||
mock.ExpectQuery("SELECT(.+)").
|
||||
WithArgs("我的文件", 1, 1).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"id", "owner_id"}).AddRow(2, 1))
|
||||
mock.ExpectCommit()
|
||||
|
||||
mock.ExpectQuery("SELECT(.+)files(.+)").WillReturnError(errors.New("not found"))
|
||||
mock.ExpectBegin()
|
||||
|
||||
Reference in New Issue
Block a user