adds missing test from postgres select actions by plan id
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
This commit is contained in:
parent
72e3fbe05b
commit
6d104dc72a
@ -265,6 +265,30 @@ func TestSelectActionsByPlanID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSelectActionsByPlanIDErr(t *testing.T) {
|
||||||
|
// set up test
|
||||||
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
idToUse := 1
|
||||||
|
|
||||||
|
str, mock := getDbMock(t)
|
||||||
|
|
||||||
|
mock.ExpectQuery("^SELECT action_id, action_description, estimated_chunks, completed_chunks, completed_on, created_at, updated_at, plan_id FROM actions WHERE plan_id = \\$1$").
|
||||||
|
WithArgs(idToUse).
|
||||||
|
WillReturnError(fmt.Errorf("example error"))
|
||||||
|
|
||||||
|
// function under test
|
||||||
|
actions, err := str.SelectActionsByPlanID(&models.Plan{PlanID: int64(idToUse)})
|
||||||
|
|
||||||
|
// test results
|
||||||
|
assert.NotNil(err)
|
||||||
|
assert.Nil(actions)
|
||||||
|
|
||||||
|
if err := mock.ExpectationsWereMet(); err != nil {
|
||||||
|
t.Errorf("unfulfilled expectations: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSelectActionById(t *testing.T) {
|
func TestSelectActionById(t *testing.T) {
|
||||||
// set up test
|
// set up test
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user