Using conservative unittest asserts

This commit is contained in:
czaky 2024-05-17 12:04:00 +00:00
parent 122a9568de
commit 8fe19d54ef
2 changed files with 41 additions and 35 deletions

View file

@ -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)