I would like to fake request parameters for unit testing. How can I achieve this in Flask?
If you prefer to use test_request_context:
import unittest
from myapp import extract_query_params
testapp = flask.Flask(__name__)
class TestFoo(unittest.TestCase):
def test_happy(self):
with testapp.test_request_context('?limit=1&offset=2'):
limit, offset = extract_query_params(['limit', 'offset'])
self.assertEquals(limit, 1)
self.assertEquals(offset, 2)