Fix: failed test due to database type

This commit is contained in:
HFO4
2019-12-03 10:42:35 +08:00
parent a13530f969
commit 5424115e51
3 changed files with 20 additions and 12 deletions

View File

@ -272,7 +272,7 @@ func TestDeleteFileByIDs(t *testing.T) {
// 出错
{
mock.ExpectBegin()
mock.ExpectExec("UPDATE(.+)delete(.+)").
mock.ExpectExec("DELETE(.+)").
WillReturnError(errors.New("error"))
mock.ExpectRollback()
err := DeleteFileByIDs([]uint{1, 2, 3})
@ -282,7 +282,7 @@ func TestDeleteFileByIDs(t *testing.T) {
// 成功
{
mock.ExpectBegin()
mock.ExpectExec("UPDATE(.+)delete(.+)").
mock.ExpectExec("DELETE(.+)").
WillReturnResult(sqlmock.NewResult(0, 3))
mock.ExpectCommit()
err := DeleteFileByIDs([]uint{1, 2, 3})