mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
test: fixed usage of wrap in tests.
This commit is contained in:
@@ -135,7 +135,7 @@ func postAlertScenario(desc string, url string, routePattern string, role m.Role
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ func postAnnotationScenario(desc string, url string, routePattern string, role m
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
@@ -246,7 +246,7 @@ func putAnnotationScenario(desc string, url string, routePattern string, role m.
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
@@ -269,7 +269,7 @@ func deleteAnnotationsScenario(desc string, url string, routePattern string, rol
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func loggedInUserScenarioWithRole(desc string, method string, url string, routeP
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
@@ -51,7 +51,7 @@ func anonymousUserScenario(desc string, method string, url string, routePattern
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
if sc.handlerFunc != nil {
|
if sc.handlerFunc != nil {
|
||||||
return sc.handlerFunc(sc.context)
|
return sc.handlerFunc(sc.context)
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ func updateDashboardPermissionScenario(desc string, url string, routePattern str
|
|||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
|
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
|
|||||||
@@ -882,7 +882,7 @@ func postDashboardScenario(desc string, url string, routePattern string, mock *d
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.SignedInUser = &m.SignedInUser{OrgId: cmd.OrgId, UserId: cmd.UserId}
|
sc.context.SignedInUser = &m.SignedInUser{OrgId: cmd.OrgId, UserId: cmd.UserId}
|
||||||
|
|
||||||
@@ -907,7 +907,7 @@ func postDiffScenario(desc string, url string, routePattern string, cmd dtos.Cal
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.SignedInUser = &m.SignedInUser{
|
sc.context.SignedInUser = &m.SignedInUser{
|
||||||
OrgId: TestOrgID,
|
OrgId: TestOrgID,
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ func updateFolderPermissionScenario(desc string, url string, routePattern string
|
|||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
|
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.OrgId = TestOrgID
|
sc.context.OrgId = TestOrgID
|
||||||
sc.context.UserId = TestUserID
|
sc.context.UserId = TestUserID
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ func createFolderScenario(desc string, url string, routePattern string, mock *fa
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.SignedInUser = &m.SignedInUser{OrgId: TestOrgID, UserId: TestUserID}
|
sc.context.SignedInUser = &m.SignedInUser{OrgId: TestOrgID, UserId: TestUserID}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ func updateFolderScenario(desc string, url string, routePattern string, mock *fa
|
|||||||
defer bus.ClearBusHandlers()
|
defer bus.ClearBusHandlers()
|
||||||
|
|
||||||
sc := setupScenarioContext(url)
|
sc := setupScenarioContext(url)
|
||||||
sc.defaultHandler = wrap(func(c *m.ReqContext) Response {
|
sc.defaultHandler = Wrap(func(c *m.ReqContext) Response {
|
||||||
sc.context = c
|
sc.context = c
|
||||||
sc.context.SignedInUser = &m.SignedInUser{OrgId: TestOrgID, UserId: TestUserID}
|
sc.context.SignedInUser = &m.SignedInUser{OrgId: TestOrgID, UserId: TestUserID}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user