You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the Error I'm getting all expectations were already fulfilled, call to database transaction Begin was not expected
I have a code in my go lang
var userRoles models.UserRole
userRoles.UserID = userID
userRoles.RoleID = id
db.Create(&userRoles)
And This Query is generated INSERT INTO user_roles (user_id,role_id,created_at,updated_at) VALUES (1,1,2020-05-08 13:35:59,2020-05-08 13:35:59)
While mocking with this code with WithArgs() and Without WithArgs()
mock.ExpectBegin()
mock.ExpectExec("INSERT INTO \"u").WithArgs(1, 1, sqlmock.AnyArg(), sqlmock.AnyArg()).WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()
I have also tried this mock.ExpectQuery("INSERT INTO user.*").WithArgs(1,1,sqlmock.AnyArg()sqlmock.AnyArg()).WillReturnRows(row)
Getting same error
The text was updated successfully, but these errors were encountered:
This is the Error I'm getting
all expectations were already fulfilled, call to database transaction Begin was not expected
I have a code in my go lang
And This Query is generated
INSERT INTO user_roles (user_id,role_id,created_at,updated_at) VALUES (1,1,2020-05-08 13:35:59,2020-05-08 13:35:59)
While mocking with this code with
WithArgs()
andWithout WithArgs()
I have also tried this
mock.ExpectQuery("INSERT INTO user.*").WithArgs(1,1,sqlmock.AnyArg()sqlmock.AnyArg()).WillReturnRows(row)
Getting same error
The text was updated successfully, but these errors were encountered: