单元测试sqlmock失败,SQL更新

We've been using sqlmock testing func() that are using select - no problems there.

It's not working with updates.

The func we want to test is:

func PutTag(tag *Tag) error {
...
    err = db.DB.Where("id=?", tag.Id).Save(tag).Error
...
}

We've defined the test func like this:

func (s *Suite) TestPutTag() {
    tag := Tag{Id: 2, Name: "Test Tag 2"}
    s.mock.ExpectBegin()
    s.mock.ExpectQuery("UPDATE `tags` SET `name` = ?  WHERE `tags`.`id` = ? AND ((id=?))").
        WithArgs(tag.Name, tag.Id, tag.Id)
    s.mock.ExpectCommit()
    err := PutTag(&tag)
    require.NoError(s.T(), err)
}

This is returning..

[2019-08-30 14:36:36]  call to ExecQuery 'UPDATE `tags` SET `name` = ?  WHERE `tags`.`id` = ? AND ((id=?))' with args [{Name: Ordinal:1 Value:Test Tag 2} {Name: Ordinal:2 Value:2} {Name: Ordinal:3 Value:2}], was not expected, next expectation is: ExpectedQuery => expecting Query, QueryContext or QueryRow which:
  - matches sql: 'UPDATE `tags` SET `name` = ?  WHERE `tags`.`id` = ? AND ((id=?))'
  - is with arguments:
    0 - Test Tag 2
    1 - 2
    2 - 2

The sql statements seem the same to me.