2020-04-16 02:41:53 +03:00
|
|
|
from app import app
|
2022-12-05 22:14:14 +03:00
|
|
|
from app.utils.session import generate_key
|
2020-04-16 02:41:53 +03:00
|
|
|
import pytest
|
2020-12-06 01:01:21 +03:00
|
|
|
import random
|
|
|
|
|
|
|
|
demo_config = {
|
|
|
|
'near': random.choice(['Seattle', 'New York', 'San Francisco']),
|
2021-04-12 23:40:59 +03:00
|
|
|
'dark': str(random.getrandbits(1)),
|
2020-12-06 01:01:21 +03:00
|
|
|
'nojs': str(random.getrandbits(1)),
|
2020-12-18 00:39:35 +03:00
|
|
|
'lang_interface': random.choice(app.config['LANGUAGES'])['value'],
|
|
|
|
'lang_search': random.choice(app.config['LANGUAGES'])['value'],
|
Use farside.link for frontend alternatives in results (#560)
* Integrate Farside into Whoogle
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
* Expand conversion of config<->url params
Config settings can now be translated to and from URL params using a
predetermined set of "safe" keys (i.e. config settings that easily
translate to URL params).
* Allow jumping instances via Farside when ratelimited
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
Closes #554
Closes #559
2021-12-09 03:27:33 +03:00
|
|
|
'country': random.choice(app.config['COUNTRIES'])['value']
|
2020-12-06 01:01:21 +03:00
|
|
|
}
|
2020-04-16 02:41:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def client():
|
2020-06-06 01:09:04 +03:00
|
|
|
with app.test_client() as client:
|
|
|
|
with client.session_transaction() as session:
|
|
|
|
session['uuid'] = 'test'
|
2022-12-05 22:14:14 +03:00
|
|
|
session['key'] = app.enc_key
|
2020-06-06 01:09:04 +03:00
|
|
|
session['config'] = {}
|
|
|
|
yield client
|