fixed to template PR issues, #13938

This commit is contained in:
Torkel Ödegaard
2018-11-02 10:49:46 +01:00
parent 70bb81c6eb
commit b415d82611
12 changed files with 89 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import (
)
func TestMiddlewareContext(t *testing.T) {
setting.ERR_TEMPLATE_NAME = "error-template"
Convey("Given the grafana middleware", t, func() {
middlewareScenario("middleware should add context to injector", func(sc *scenarioContext) {

View File

@@ -138,7 +138,7 @@ func Recovery() macaron.Handler {
c.JSON(500, resp)
} else {
c.HTML(500, "error")
c.HTML(500, setting.ERR_TEMPLATE_NAME)
}
}
}()

View File

@@ -8,11 +8,14 @@ import (
"github.com/grafana/grafana/pkg/bus"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/session"
"github.com/grafana/grafana/pkg/setting"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/macaron.v1"
)
func TestRecoveryMiddleware(t *testing.T) {
setting.ERR_TEMPLATE_NAME = "error-template"
Convey("Given an api route that panics", t, func() {
apiURL := "/api/whatever"
recoveryScenario("recovery middleware should return json", apiURL, func(sc *scenarioContext) {
@@ -50,6 +53,7 @@ func recoveryScenario(desc string, url string, fn scenarioFunc) {
sc := &scenarioContext{
url: url,
}
viewsPath, _ := filepath.Abs("../../public/views")
sc.m = macaron.New()