def setUpClass(cls): super(TestOrderModule, cls).setUpClass() # 从cookie.json中读取PHPSESSID cookie_file = os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'data/cookie.json') php_session_id = JsonUtil.get_data(cookie_file, 'PHPSESSID') cls.cookies = {"PHPSESSID": php_session_id}
def __init__(self): self.config_util = Config.ConfigUtil() self.base_url = self.config_util.get_option_value_by_section( 'crm', 'base_url') self.request = RequestUtil.RequestUtil(self.base_url) # 从cookie.json中读取PHPSESSID cookie_file = os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'data/cookie.json') php_session_id = JsonUtil.get_data(cookie_file, 'PHPSESSID') self.cookies = {"PHPSESSID": php_session_id} self.headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" }