All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.golang.database.executor.service_executor.test.insert.template Maven / Gradle / Ivy

func TestExecute@title@ServiceExecutor(t *testing.T) {
    request := &fs.@service_request@{}
    model := mappers.Make@service_request@VO(request)
	args := executor.@title@Args(model)
    ctx := context.Background()

    Mock.ExpectExec("INSERT INTO").WithArgs(@args@).WillReturnResult(sqlmock.NewResult(1, 1))
    resp, err := executor.RequestExecutor.Execute@title@(ctx, request)
	assert := assert.New(t)
	assert.Equal(fs.StatusCode_SUCCESS, resp.Status.Status)

    er := errors.New("Some Error")
    Mock.ExpectExec("INSERT INTO").WithArgs(@args@).WillReturnError(er)
    resp, err = executor.RequestExecutor.Execute@title@(ctx, request)
    assert.Equal(er, err)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy