mirror of
https://github.com/benbusby/whoogle-search
synced 2024-11-01 03:20:30 +00:00
baa7a87efb
Config boolean environment variables need to be cast to ints, since they are set or unset using 0 and 1. Previously they were interpreted as (pseudocode) read_var(name, default=False), which meant that setting CONFIG_VAR=0 would enable that variable since Python reads environment variables as strings, and '0' is truthy. This updates the previous logic to (still pseudocode) int(read_var(name, default='0')). Fixes #279
24 lines
729 B
Python
24 lines
729 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': 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
|