Add test with many endpoints

This commit is contained in:
Rak Alexey 2020-04-12 18:55:55 +00:00 committed by Fedor Korotkiy
parent f2ae922024
commit bbab13a995

View file

@ -282,6 +282,40 @@ rules:
},
expected: result{code: http.StatusForbidden, body: "Forbidden"},
},
{
name: "many-rules-forbidden",
conf: `
rules:
- endpoint: "/list"
forbidden_response_re:
- '.*admin.*'
- endpoint: "/dump"
max_response_length_bytes: 4
`,
service: echoService,
makeRequest: func() *resty.Request {
return c.R().SetBody(`hello`)
},
endpoint: "/dump",
expected: result{code: http.StatusForbidden, body: "Forbidden"},
},
{
name: "many-rules-ok",
conf: `
rules:
- endpoint: "/list"
forbidden_response_re:
- '.*admin.*'
- endpoint: "/dump"
max_response_length_bytes: 4
`,
service: echoService,
makeRequest: func() *resty.Request {
return c.R().SetBody(`hello`)
},
endpoint: "/list",
expected: result{code: http.StatusOK, body: "hello"},
},
} {
t.Run(tc.name, func(t *testing.T) {
service := httptest.NewServer(tc.service)