Update unit tests to use set and issubset
This commit is contained in:
parent
da219575a1
commit
893e3000a9
@ -17,8 +17,7 @@ def start_web_server():
|
|||||||
def test_fetch_list():
|
def test_fetch_list():
|
||||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
||||||
result = fetch_list('http://localhost:8888/proxies1.txt')
|
result = fetch_list('http://localhost:8888/proxies1.txt')
|
||||||
for proxy in expected:
|
assert set(expected).issubset(result)
|
||||||
assert proxy in result
|
|
||||||
|
|
||||||
|
|
||||||
def test_fetch_list_fail():
|
def test_fetch_list_fail():
|
||||||
@ -30,12 +29,10 @@ def test_fetch_list_fail():
|
|||||||
def test_fetch_list_only_valid():
|
def test_fetch_list_only_valid():
|
||||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
||||||
result = fetch_list('http://localhost:8888/proxies1.txt')
|
result = fetch_list('http://localhost:8888/proxies1.txt')
|
||||||
for proxy in expected:
|
assert set(expected).issubset(result)
|
||||||
assert proxy in result
|
|
||||||
|
|
||||||
|
|
||||||
def test_fetch_all():
|
def test_fetch_all():
|
||||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002', '127.0.0.1:9999']
|
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002', '127.0.0.1:9999']
|
||||||
result = fetch_all(['http://localhost:8888/proxies1.txt', 'http://localhost:8888/proxies2.txt'])
|
result = fetch_all(['http://localhost:8888/proxies1.txt', 'http://localhost:8888/proxies2.txt'])
|
||||||
for proxy in expected:
|
assert set(expected).issubset(result)
|
||||||
assert proxy in result
|
|
||||||
|
Loading…
Reference in New Issue
Block a user