This moves away from the previous (messy) approach of using two separate keys for decrypting text and element URLs separately and regenerating them for new searches. The current implementation of sessions is not very reliable, which lead to keys being regenerated too soon, which would break page navigation. Until that can be addressed, the single key per session approach should work a lot better. Fixes #250 Fixes #90
24 lines
734 B
Python
24 lines
734 B
Python
from app import app
|
|
from app.utils.session import generate_user_key
|
|
import pytest
|
|
import random
|
|
|
|
demo_config = {
|
|
'near': random.choice(['Seattle', 'New York', 'San Francisco']),
|
|
'dark_mode': str(random.getrandbits(1)),
|
|
'nojs': str(random.getrandbits(1)),
|
|
'lang_interface': random.choice(app.config['LANGUAGES'])['value'],
|
|
'lang_search': random.choice(app.config['LANGUAGES'])['value'],
|
|
'ctry': random.choice(app.config['COUNTRIES'])['value']
|
|
}
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
with app.test_client() as client:
|
|
with client.session_transaction() as session:
|
|
session['uuid'] = 'test'
|
|
session['key'] = generate_user_key()
|
|
session['config'] = {}
|
|
yield client
|