|
|
|
@ -333,6 +333,11 @@ func TestFileSystem_Delete(t *testing.T) {
|
|
|
|
|
mock.ExpectExec("DELETE(.+)files").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 删除对应分享
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)shares").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 归还容量
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)users").
|
|
|
|
@ -343,6 +348,11 @@ func TestFileSystem_Delete(t *testing.T) {
|
|
|
|
|
mock.ExpectExec("DELETE(.+)folders").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 删除对应分享
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)shares").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
|
|
|
|
|
err := fs.Delete(ctx, []uint{1}, []uint{1})
|
|
|
|
|
asserts.Error(err)
|
|
|
|
@ -379,6 +389,11 @@ func TestFileSystem_Delete(t *testing.T) {
|
|
|
|
|
mock.ExpectExec("DELETE(.+)").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 删除对应分享
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)shares").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 归还容量
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)").
|
|
|
|
@ -389,6 +404,11 @@ func TestFileSystem_Delete(t *testing.T) {
|
|
|
|
|
mock.ExpectExec("DELETE(.+)").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
// 删除对应分享
|
|
|
|
|
mock.ExpectBegin()
|
|
|
|
|
mock.ExpectExec("UPDATE(.+)shares").
|
|
|
|
|
WillReturnResult(sqlmock.NewResult(0, 3))
|
|
|
|
|
mock.ExpectCommit()
|
|
|
|
|
|
|
|
|
|
fs.FileTarget = []model.File{}
|
|
|
|
|
fs.DirTarget = []model.Folder{}
|
|
|
|
|