mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Using conservative unittest asserts
This commit is contained in:
parent
122a9568de
commit
8fe19d54ef
2 changed files with 41 additions and 35 deletions
|
|
@ -49,24 +49,30 @@ class TestNetwork(SearxTestCase): # pylint: disable=missing-class-docstring
|
|||
|
||||
def test_proxies_by_patterns(self):
|
||||
network = Network(proxies='http://localhost:1337')
|
||||
assert network._proxies_by_pattern == {'all://': ('http://localhost:1337',)}
|
||||
self.assertEqual(network._proxies_by_pattern, {'all://': ('http://localhost:1337',)})
|
||||
|
||||
network = Network(proxies={'https': 'http://localhost:1337', 'http': 'http://localhost:1338'})
|
||||
assert network._proxies_by_pattern == {
|
||||
'https://': ('http://localhost:1337',),
|
||||
'http://': ('http://localhost:1338',),
|
||||
}
|
||||
self.assertEqual(
|
||||
network._proxies_by_pattern,
|
||||
{
|
||||
'https://': ('http://localhost:1337',),
|
||||
'http://': ('http://localhost:1338',),
|
||||
},
|
||||
)
|
||||
|
||||
network = Network(
|
||||
proxies={'https': ['http://localhost:1337', 'http://localhost:1339'], 'http': 'http://localhost:1338'}
|
||||
)
|
||||
assert network._proxies_by_pattern == {
|
||||
'https://': (
|
||||
'http://localhost:1337',
|
||||
'http://localhost:1339',
|
||||
),
|
||||
'http://': ('http://localhost:1338',),
|
||||
}
|
||||
self.assertEqual(
|
||||
network._proxies_by_pattern,
|
||||
{
|
||||
'https://': (
|
||||
'http://localhost:1337',
|
||||
'http://localhost:1339',
|
||||
),
|
||||
'http://': ('http://localhost:1338',),
|
||||
},
|
||||
)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Network(proxies=1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue