summaryrefslogtreecommitdiff
path: root/tests/unit/test_preferences.py
diff options
context:
space:
mode:
authorrachmadani haryono <rachmadaniHaryono@users.noreply.github.com>2019-07-17 15:42:40 +0800
committerAlexandre Flament <alex@al-f.net>2019-07-17 09:42:40 +0200
commit8f44014627ff26019c0ffc01f77394f56dfb7db1 (patch)
tree36df76629d8e1b08fa07ef9038d1674b63a788dc /tests/unit/test_preferences.py
parent582f3bfcbc468ba3fd4dec09e81be7ecd42bcbff (diff)
downloadsearxng-8f44014627ff26019c0ffc01f77394f56dfb7db1.tar.gz
searxng-8f44014627ff26019c0ffc01f77394f56dfb7db1.zip
[fix] preference query parameter decoding (#1599)
Fix issue #1598
Diffstat (limited to 'tests/unit/test_preferences.py')
-rw-r--r--tests/unit/test_preferences.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/test_preferences.py b/tests/unit/test_preferences.py
index 885c515e2..61ac0e8e4 100644
--- a/tests/unit/test_preferences.py
+++ b/tests/unit/test_preferences.py
@@ -122,3 +122,23 @@ class TestSettings(SearxTestCase):
plugin3 = PluginStub('plugin3', True)
setting = PluginsSetting('name', choices=[plugin1, plugin2, plugin3])
self.assertEquals(setting.get_enabled(), set(['plugin1', 'plugin3']))
+
+
+class TestPreferences(SearxTestCase):
+
+ def test_encode(self):
+ from searx.preferences import Preferences
+ pref = Preferences(['oscar'], ['general'], {}, [])
+ url_params = 'eJx1VMmO2zAM_Zr6YrTocujJh6JF0QEKzKAz7VVgJNohLIseUU7ivy-VcWy5yyGOTVGP73GLKJNPYjiYgGeT4NB8BS9YOSY' \
+ 'TUdifMDYM-vmGY1d5CN0EHTYOK88W_PXNkcDBozOjnzoK0vyi4bWnHs2RU4-zvHr_-RF9a-5Cy3GARByy7X7EkKMoBeMp9CuPQ-SzYMx' \
+ '8Vr9P1qKI-XJ_p1fOkRJWNCgVM0a-zAttmBJbHkaPSZlNts-_jiuBFgUh2mPztkpHHLBhsRArDHvm356eHh5vATS0Mqagr0ZsZO_V8hT' \
+ 'B9srt54_v6jewJugqL4Nn_hYSdhxnI-jRpi05GDQCStOT7UGVmJY8ZnltRKyF23SGiLWjqNcygKGkpyeGZIywJfD1gI5AjRTAmBM55Aw' \
+ 'Q0Tn626lj7jzWo4e5hnEsIlprX6dTgdBRpyRBFKTDgBF8AasVyT4gvSTEoXRpXWRyG3CYQYld65I_V6lboILTMAlZY65_ejRDcHgp0Tv' \
+ 'EPtGAsqTiBf3m76g7pP9B84mwjPvuUtASRDei1nDF2ix_JXW91UJkXrPh6RAhznVmKyQl7dwJdMJ6bz1QOmgzYlrEzHDMcEUuo44AgS1' \
+ 'CvkjaOb2Q2AyY5oGDTs_OLXE_c2I5cg9hk3kEJZ0fu4SuktsIA2RhuJwP86AdripThCBeO9uVUejyPGmFSxPrqEYcuWi25zOEXV9tc1m' \
+ '_KP1nafYtdfv6Q9hKfWmGm9A_3G635UwiVndLGdFCiLWkONk0xUxGLGGweGWTa2nZYZ0fS1YKlE3Uuw8fPl52E5U8HJYbC7sbjXUsrnT' \
+ 'XHXRbELfO-1fGSqskiGnMK7B0dV3t8Lq08pbdtYpuVdoKWA2Yjuyah_vHp2rZWjo0zXL8Gw8DTj0='
+ pref.parse_encoded_data(url_params)
+ self.assertEqual(
+ vars(pref.key_value_settings['categories']),
+ {'value': ['general'], 'choices': ['general', 'none']})