2022-01-28 10:55:09 -06:00
|
|
|
package queryhistory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2023-01-30 02:21:27 -06:00
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
2022-01-28 10:55:09 -06:00
|
|
|
)
|
|
|
|
|
2022-05-24 04:04:03 -05:00
|
|
|
func TestIntegrationCreateQueryInQueryHistory(t *testing.T) {
|
2022-06-10 10:46:21 -05:00
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("skipping integration test")
|
|
|
|
}
|
2022-01-28 10:55:09 -06:00
|
|
|
testScenario(t, "When users tries to create query in query history it should succeed",
|
|
|
|
func(t *testing.T, sc scenarioContext) {
|
|
|
|
command := CreateQueryInQueryHistoryCommand{
|
2022-02-04 09:14:36 -06:00
|
|
|
DatasourceUID: "NCzh67i",
|
2023-08-30 10:46:47 -05:00
|
|
|
Queries: simplejson.NewFromAny(map[string]any{
|
2022-01-28 10:55:09 -06:00
|
|
|
"expr": "test",
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
sc.reqContext.Req.Body = mockRequestBody(command)
|
|
|
|
resp := sc.service.createHandler(sc.reqContext)
|
|
|
|
require.Equal(t, 200, resp.Status())
|
|
|
|
})
|
|
|
|
}
|