diff --git a/conftest.py b/conftest.py index 2c5100b3ffbb5f516fca14b0b89fd4d72ba4f530..0077b3d277f32ef20aea28a2e9019e3f5fc9c4b4 100644 --- a/conftest.py +++ b/conftest.py @@ -74,7 +74,7 @@ def customer_login(): version_url = 'https://allplatformtest.sealapps.com/api/v1/shop/local/getCustomerHtmlLinks?customerDomain=https://utest.sealapps.com&shopDomain=zhs-test.myshopify.com' if env == 'test' else 'https://api.willdesk.com/api/v1/shop/local/getCustomerHtmlLinks?customerDomain=https://u.willdesk.com&shopDomain=test-2023013104.myshopify.com' shop_url = 'https://allplatformtest.sealapps.com/api/v1/setting/getCShopSetting?domain=zhs-test.myshopify.com' if env == 'test' else 'https://api.willdesk.com/api/v1/setting/getCShopSetting?domain=test-2023013104.myshopify.com' version_res = session.get(url=version_url,headers=headers).text - c_token = re.findall(r'utest.sealapps.com/(.*?)/assets',version_res)[0] + customer_v = re.findall(r'utest.sealapps.com/(.*?)/assets',version_res)[0] shop_res = session.get(url=shop_url,headers=headers).json() login_url = f'{config_handler.base_config.get_value("url",address)}/api/v1/customer/login' #登录的api data = { @@ -85,10 +85,11 @@ def customer_login(): 'shopId' : shop_res['data']['shopInfo']['shopId'], 'timeZone' : '8', 'userName' : 'autotest_customer', - 'v' : c_token + 'v' : customer_v } + setattr(global_variate.Global,'customer_v',customer_v) login_res = session.post(url=login_url,json=data,headers=headers).json() - setattr(global_variate.Global,'clientToken',login_res['data']['accessToken']) + setattr(global_variate.Global,'customerToken',login_res['data']['accessToken']) setattr(global_variate.Global,'customerId',login_res['data']['customerId']) setattr(global_variate.Global,'customerName',login_res['data']['name']) address = 'wss://atestws.sealapps.com/ws' if env == 'test' else 'wss://ws.willdesk.com/ws' @@ -98,7 +99,7 @@ def customer_login(): url=f'{address}?platform=1&authorization={global_variate.Global.access_token}&t={int(time.time())}', attr='willdesk') # willdesk账号websocket链接 websocket_handler.ws_client = websocket_handler.ws( - url=f'{address}?platform=1&authorization={global_variate.Global.clientToken}&t={int(time.time())}', + url=f'{address}?platform=1&authorization={global_variate.Global.customerToken}&t={int(time.time())}', attr='customer') # c端websocket链接 async def close_ws():