2020-04-15 23:41:53 +00:00
|
|
|
from app import app
|
2021-04-01 04:23:30 +00:00
|
|
|
from app.utils.session import generate_user_key
|
2020-04-15 23:41:53 +00:00
|
|
|
import pytest
|
2020-12-05 22:01:21 +00:00
|
|
|
import random
|
|
|
|
|
|
|
|
demo_config = {
|
|
|
|
'near': random.choice(['Seattle', 'New York', 'San Francisco']),
|
2021-04-12 20:40:59 +00:00
|
|
|
'dark': str(random.getrandbits(1)),
|
2020-12-05 22:01:21 +00:00
|
|
|
'nojs': str(random.getrandbits(1)),
|
2020-12-17 21:39:35 +00:00
|
|
|
'lang_interface': random.choice(app.config['LANGUAGES'])['value'],
|
|
|
|
'lang_search': random.choice(app.config['LANGUAGES'])['value'],
|
|
|
|
'ctry': random.choice(app.config['COUNTRIES'])['value']
|
2020-12-05 22:01:21 +00:00
|
|
|
}
|
2020-04-15 23:41:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def client():
|
2020-06-05 22:09:04 +00:00
|
|
|
with app.test_client() as client:
|
|
|
|
with client.session_transaction() as session:
|
|
|
|
session['uuid'] = 'test'
|
2021-04-01 04:23:30 +00:00
|
|
|
session['key'] = generate_user_key()
|
2020-06-05 22:09:04 +00:00
|
|
|
session['config'] = {}
|
|
|
|
yield client
|