MCPcopy Create free account
hub / github.com/github/gh-aw / TestIsRequestAllowed

Function TestIsRequestAllowed

pkg/cli/firewall_log_test.go:220–303  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func TestIsRequestAllowed(t *testing.T) {
221 tests := []struct {
222 name string
223 decision string
224 status string
225 expected bool
226 }{
227 {
228 name: "status 200",
229 decision: "TCP_TUNNEL:HIER_DIRECT",
230 status: "200",
231 expected: true,
232 },
233 {
234 name: "status 206",
235 decision: "TCP_TUNNEL:HIER_DIRECT",
236 status: "206",
237 expected: true,
238 },
239 {
240 name: "status 304",
241 decision: "TCP_TUNNEL:HIER_DIRECT",
242 status: "304",
243 expected: true,
244 },
245 {
246 name: "status 403",
247 decision: "NONE_NONE:HIER_NONE",
248 status: "403",
249 expected: false,
250 },
251 {
252 name: "status 407",
253 decision: "NONE_NONE:HIER_NONE",
254 status: "407",
255 expected: false,
256 },
257 {
258 name: "TCP_TUNNEL decision",
259 decision: "TCP_TUNNEL:HIER_DIRECT",
260 status: "0",
261 expected: true,
262 },
263 {
264 name: "TCP_HIT decision",
265 decision: "TCP_HIT:HIER_DIRECT",
266 status: "0",
267 expected: true,
268 },
269 {
270 name: "TCP_MISS decision",
271 decision: "TCP_MISS:HIER_DIRECT",
272 status: "0",
273 expected: true,
274 },
275 {
276 name: "NONE_NONE decision",
277 decision: "NONE_NONE:HIER_NONE",

Callers

nothing calls this directly

Calls 3

isRequestAllowedFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected