mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 11:44:26 -06:00
50c2b4682a
* Chore: Rename integration tests * Remove one Integration Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package queryhistory
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/web"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestIntegrationStarQueryInQueryHistory(t *testing.T) {
|
|
testScenarioWithQueryInQueryHistory(t, "When users tries to star query in query history that does not exists, it should fail",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
resp := sc.service.starHandler(sc.reqContext)
|
|
require.Equal(t, 500, resp.Status())
|
|
})
|
|
|
|
testScenarioWithQueryInQueryHistory(t, "When users tries to star query in query history that exists, it should succeed",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
sc.ctx.Req = web.SetURLParams(sc.ctx.Req, map[string]string{":uid": sc.initialResult.Result.UID})
|
|
resp := sc.service.starHandler(sc.reqContext)
|
|
require.Equal(t, 200, resp.Status())
|
|
})
|
|
|
|
testScenarioWithQueryInQueryHistory(t, "When users tries to star query that is already starred, it should fail",
|
|
func(t *testing.T, sc scenarioContext) {
|
|
sc.ctx.Req = web.SetURLParams(sc.ctx.Req, map[string]string{":uid": sc.initialResult.Result.UID})
|
|
sc.service.starHandler(sc.reqContext)
|
|
resp := sc.service.starHandler(sc.reqContext)
|
|
require.Equal(t, 500, resp.Status())
|
|
})
|
|
}
|