mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Create config to enable/disable query history * Create add to query history functionality * Add documentation * Add test * Refactor * Add test * Fix built errors and linting errors * Refactor * Remove old tests * Refactor, adjust based on feedback, add new test * Update default value
24 lines
645 B
Go
24 lines
645 B
Go
package queryhistory
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCreateQueryInQueryHistory(t *testing.T) {
|
|
testScenario(t, "When users tries to create query in query history it should succeed",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
command := CreateQueryInQueryHistoryCommand{
|
|
DatasourceUid: "NCzh67i",
|
|
Queries: simplejson.NewFromAny(map[string]interface{}{
|
|
"expr": "test",
|
|
}),
|
|
}
|
|
sc.reqContext.Req.Body = mockRequestBody(command)
|
|
resp := sc.service.createHandler(sc.reqContext)
|
|
require.Equal(t, 200, resp.Status())
|
|
})
|
|
}
|