Macaron: remove custom Request type (#37874)
* remove macaron.Request, use http.Request instead * remove com dependency from bindings module * fix another c.Req.Request
This commit is contained in:
@@ -103,9 +103,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "http://localhost/asd", nil)
|
||||
require.NoError(t, err)
|
||||
ctx := &models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{Request: req},
|
||||
},
|
||||
Context: &macaron.Context{Req: req},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
return ctx, req
|
||||
@@ -239,9 +237,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "http://localhost/asd", nil)
|
||||
require.NoError(t, err)
|
||||
ctx := &models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{Request: req},
|
||||
},
|
||||
Context: &macaron.Context{Req: req},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
|
||||
@@ -450,9 +446,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
ctx := &models.ReqContext{
|
||||
SignedInUser: &models.SignedInUser{UserId: 1},
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{Request: req},
|
||||
},
|
||||
Context: &macaron.Context{Req: req},
|
||||
}
|
||||
mockAuthToken := mockOAuthTokenService{
|
||||
token: &oauth2.Token{
|
||||
@@ -582,9 +576,7 @@ func TestDataSourceProxy_requestHandling(t *testing.T) {
|
||||
return &models.ReqContext{
|
||||
SignedInUser: &models.SignedInUser{},
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{
|
||||
Request: httptest.NewRequest("GET", "/render", nil),
|
||||
},
|
||||
Req: httptest.NewRequest("GET", "/render", nil),
|
||||
Resp: responseWriter,
|
||||
},
|
||||
}, ds
|
||||
@@ -647,7 +639,7 @@ func TestDataSourceProxy_requestHandling(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
ctx.Req.Request = httptest.NewRequest("GET", "/api/datasources/proxy/1/path/%2Ftest%2Ftest%2F?query=%2Ftest%2Ftest%2F", nil)
|
||||
ctx.Req = httptest.NewRequest("GET", "/api/datasources/proxy/1/path/%2Ftest%2Ftest%2F?query=%2Ftest%2Ftest%2F", nil)
|
||||
proxy, err := NewDataSourceProxy(ds, plugin, ctx, "/path/%2Ftest%2Ftest%2F", &setting.Cfg{}, httpClientProvider, &oauthtoken.Service{})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -661,9 +653,7 @@ func TestDataSourceProxy_requestHandling(t *testing.T) {
|
||||
|
||||
func TestNewDataSourceProxy_InvalidURL(t *testing.T) {
|
||||
ctx := models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{},
|
||||
},
|
||||
Context: &macaron.Context{},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
ds := models.DataSource{
|
||||
@@ -679,9 +669,7 @@ func TestNewDataSourceProxy_InvalidURL(t *testing.T) {
|
||||
|
||||
func TestNewDataSourceProxy_ProtocolLessURL(t *testing.T) {
|
||||
ctx := models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{},
|
||||
},
|
||||
Context: &macaron.Context{},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
ds := models.DataSource{
|
||||
@@ -699,9 +687,7 @@ func TestNewDataSourceProxy_ProtocolLessURL(t *testing.T) {
|
||||
// Test wth MSSQL type data sources.
|
||||
func TestNewDataSourceProxy_MSSQL(t *testing.T) {
|
||||
ctx := models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{},
|
||||
},
|
||||
Context: &macaron.Context{},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
tcs := []struct {
|
||||
@@ -899,9 +885,7 @@ func Test_PathCheck(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "http://localhost/asd", nil)
|
||||
require.NoError(t, err)
|
||||
ctx := &models.ReqContext{
|
||||
Context: &macaron.Context{
|
||||
Req: macaron.Request{Request: req},
|
||||
},
|
||||
Context: &macaron.Context{Req: req},
|
||||
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_VIEWER},
|
||||
}
|
||||
return ctx, req
|
||||
|
||||
Reference in New Issue
Block a user