Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- from ... import application
- class FakeInput(object):
- def __init__(self, fakedata):
- self.fakedata = fakedata
- def read():
- return self.fakedata
- environ = json.loads(....) # Here we load bait json. If it's POST, it should contain POST body as ["postdata"]
- if environ["REQUEST_METHOD"] == "POST":
- environ["wsgi.input"] = FakeInput(environ["postdata"])
- result_status = None
- def start_response(status, *shitargs):
- global result_status
- result_status = status
- result = application(environ, start_response)
- # Check expected values of result_status, maybe also result
Advertisement
Add Comment
Please, Sign In to add comment