mirror of
https://github.com/benbusby/whoogle-search
synced 2024-10-30 09:20:50 +00:00
6e7ec9918a
Moves the language and country dicts from the config model to json files that are loaded during app init and stored in the app config dict. This substantially improves the readability of the config model and allows for much more sensible loading of the language/country options.
24 lines
750 B
Python
24 lines
750 B
Python
from app import app
|
|
from app.utils.session_utils import generate_user_keys
|
|
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['fernet_keys'] = generate_user_keys()
|
|
session['config'] = {}
|
|
yield client
|