I can't get cookie which I have set previously via flask.test_client
.
Just look
My fixture:
@pytest.fixture(scope='module')
def client():
app.config['TESTING'] = True
settings = Settings()
ctx = app.app_context()
ctx.push()
with app.test_client() as client:
yield client
ctx.pop()
os.system("rm -rf logs json")
And the test:
def test_test(client):
# order cookie is set to url_encoded '{}' by default
to_set = {"1": 2}
client.set_cookie('order', json.dumps(to_set))
print(request.cookies.get('order')) # prints url-encoded '{}'
What am I doing wrong? I need to get cookie which I had set previously for testing. How can I do that?