Commit cf430e35 authored by zhanhuasheng's avatar zhanhuasheng

初始化clientId

parent 999ac4c9
......@@ -7,9 +7,7 @@ from Utils import config_handler
from Utils import global_variate
from Utils import websocket_handler
session = requests.session()
def willdesk_login():
'''
执行用例前获取登录态的接口,全局只执行一次,通过env参数控制是否测试环境
......@@ -93,7 +91,6 @@ def customer_login():
setattr(global_variate.Global,'customerName',login_res['data']['name'])
address = 'wss://atestws.sealapps.com/ws' if env == 'test' else 'wss://ws.willdesk.com/ws'
print(f'{address}?platform=1&authorization={global_variate.Global.access_token}&t={int(time.time())}')
websocket_handler.ws_willdesk = websocket_handler.ws(
url=f'{address}?platform=1&authorization={global_variate.Global.access_token}&t={int(time.time())}',
attr='willdesk') # willdesk账号websocket链接
......@@ -103,13 +100,19 @@ def customer_login():
async def close_ws():
await asyncio.gather(asyncio.create_task(websocket_handler.ws_willdesk.close()),asyncio.create_task(websocket_handler.ws_client.close()))
async def get_client_id():
await asyncio.gather(asyncio.create_task(websocket_handler.ws_willdesk.get_client_id()),asyncio.create_task(websocket_handler.ws_client.get_client_id()))
loop = websocket_handler.loop
@pytest.fixture(scope='session',autouse=True)
def call_fixture():
#自定义调用顺序
willdesk_login()
customer_login()
loop.run_until_complete(get_client_id()) #初始化获取clientid
yield
loop = websocket_handler.loop
loop.run_until_complete(close_ws())
loop.run_until_complete(close_ws()) #关闭服务
loop.stop()
loop.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment