"ddos challenge" style script #4
1 changed files with 44 additions and 0 deletions
|
|
@ -39,6 +39,17 @@ function TestDDoSProtectionChallenge:setup()
|
|||
-- Mock ngx.time for consistent testing
|
||||
ngx.time = function() return 1000000 end
|
||||
|
||||
-- Add missing ngx.req functions
|
||||
ngx.req.read_body = function() end
|
||||
ngx.req.get_post_args = function()
|
||||
return ngx._post_args or {}
|
||||
end
|
||||
ngx.req.get_headers = function()
|
||||
return ngx._headers or {}
|
||||
end
|
||||
ngx.header = {}
|
||||
ngx.var.request_method = 'GET'
|
||||
|
||||
-- Setup module manually (can't use setupTest because it calls resetNgx)
|
||||
local ctx = require('ctx')
|
||||
local config = require('config')
|
||||
|
|
@ -224,6 +235,17 @@ function TestDDoSProtectionChallengePaths:setup()
|
|||
|
||||
ngx.time = function() return 1000000 end
|
||||
|
||||
-- Add missing ngx.req functions
|
||||
ngx.req.read_body = function() end
|
||||
ngx.req.get_post_args = function()
|
||||
return ngx._post_args or {}
|
||||
end
|
||||
ngx.req.get_headers = function()
|
||||
return ngx._headers or {}
|
||||
end
|
||||
ngx.header = {}
|
||||
ngx.var.request_method = 'GET'
|
||||
|
||||
-- Setup module manually
|
||||
local ctx = require('ctx')
|
||||
local config = require('config')
|
||||
|
|
@ -381,6 +403,17 @@ function TestDDoSProtectionChallengeQuestion:setup()
|
|||
|
||||
ngx.time = function() return 1000000 end
|
||||
|
||||
-- Add missing ngx.req functions
|
||||
ngx.req.read_body = function() end
|
||||
ngx.req.get_post_args = function()
|
||||
return ngx._post_args or {}
|
||||
end
|
||||
ngx.req.get_headers = function()
|
||||
return ngx._headers or {}
|
||||
end
|
||||
ngx.header = {}
|
||||
ngx.var.request_method = 'GET'
|
||||
|
||||
-- Setup module manually
|
||||
local ctx = require('ctx')
|
||||
local config = require('config')
|
||||
|
|
@ -506,6 +539,17 @@ function TestDDoSProtectionChallengePow:setup()
|
|||
|
||||
ngx.time = function() return 1000000 end
|
||||
|
||||
-- Add missing ngx.req functions
|
||||
ngx.req.read_body = function() end
|
||||
ngx.req.get_post_args = function()
|
||||
return ngx._post_args or {}
|
||||
end
|
||||
ngx.req.get_headers = function()
|
||||
return ngx._headers or {}
|
||||
end
|
||||
ngx.header = {}
|
||||
ngx.var.request_method = 'GET'
|
||||
|
||||
-- Setup module manually
|
||||
local ctx = require('ctx')
|
||||
local config = require('config')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue