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

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

func TestExecute@title@ServiceExecutor(t *testing.T) {
    request := &fs.@service_request@{}
    rows := sqlmock.NewRows([]string{@column_names@}).
    AddRow(@colvalues@)
    ctx := context.Background()

    Mock.ExpectQuery("SELECT").WillReturnRows(rows)
    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.ExpectQuery("SELECT").WillReturnError(er)
    resp, err = executor.RequestExecutor.Execute@title@(ctx, request)
	assert.Equal(er, err)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy