mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
6e96506c23
* Query history: Add search functionality * Add more tests * Add documentation * Fix spell errors * Update docs * Update docs * Fix lint error * Update docs/sources/http_api/query_history.md Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com> * Document limit * Run tests with postgres and mysql * Use CASE insted of IIF * Use BooleanStr instead of 1 * Change LIKE to LikeStr() * Return back integration tests * Update SQL to use Bool() everywhere * Create new tests for sorting * Update docs/sources/http_api/query_history.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update docs/sources/http_api/query_history.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update docs/sources/http_api/query_history.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update docs/sources/http_api/query_history.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update docs/sources/http_api/query_history.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Add page, count and limit to results * Remove newline * Update documentation * Update docs Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
29 lines
1014 B
Go
29 lines
1014 B
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package queryhistory
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/web"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPatchQueryCommentInQueryHistory(t *testing.T) {
|
|
testScenarioWithQueryInQueryHistory(t, "When user tries to patch comment of query in query history that does not exist, it should fail",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
resp := sc.service.patchCommentHandler(sc.reqContext)
|
|
require.Equal(t, 500, resp.Status())
|
|
})
|
|
|
|
testScenarioWithQueryInQueryHistory(t, "When user tries to patch comment of query in query history that exists, it should succeed",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
cmd := PatchQueryCommentInQueryHistoryCommand{Comment: "test comment"}
|
|
sc.ctx.Req = web.SetURLParams(sc.ctx.Req, map[string]string{":uid": sc.initialResult.Result.UID})
|
|
sc.reqContext.Req.Body = mockRequestBody(cmd)
|
|
resp := sc.service.patchCommentHandler(sc.reqContext)
|
|
require.Equal(t, 200, resp.Status())
|
|
})
|
|
}
|