How can I set the remote_addr
property in a flask test_request_context? This question: Get IP Address when testing flask application through nosetests (and other, similar questions) explains how to do it using the get/post/whatever test client calls, but I'm not using those (in this case). Instead, I get a test_request_context and then call a function, thereby allowing me to test the functions that are called by my view functions individually.
Edit: to clarify, my testing code looks something like this:
with app.test_request_context():
result=my_function_which_expects_to_be_called_from_a_request_context()
<check result however>
So at no point am I using a test client call.