forked from jhao104/proxy_pool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestGetFreeProxy.py
37 lines (32 loc) · 1.11 KB
/
testGetFreeProxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: testGetFreeProxy
Description : test model ProxyGetter/getFreeProxy
Author : J_hao
date: 2017/7/31
-------------------------------------------------
Change Activity:
2017/7/31:function testGetFreeProxy
-------------------------------------------------
"""
__author__ = 'J_hao'
from ProxyGetter.getFreeProxy import GetFreeProxy
from Util.GetConfig import GetConfig
# noinspection PyPep8Naming
def testGetFreeProxy():
"""
test class GetFreeProxy in ProxyGetter/GetFreeProxy
:return:
"""
gc = GetConfig()
proxy_getter_functions = gc.proxy_getter_functions
for proxyGetter in proxy_getter_functions:
proxy_count = 0
for proxy in getattr(GetFreeProxy, proxyGetter.strip())():
if proxy:
print('{func}: fetch proxy {proxy}'.format(func=proxyGetter, proxy=proxy))
proxy_count += 1
assert proxy_count >= 20, '{} fetch proxy fail'.format(proxyGetter)
if __name__ == '__main__':
testGetFreeProxy()