When you use 'task=test'
test_client
do not set application/x-www-form-urlencoded
content type, because you put string to input stream. So flask can't detect form and read data from form and reqparse
will return None
for any values for this case.
To fix it you must set up content type or use dict {'task': 'test'}
or tuple.
Also for request testing better to use client = self.app.test_client()
instead app = self.app.test_client()
, if you use FlaskTesting.TestCase
class, then just call self.client.post
.