Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
willdesk_apiauto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
29
Issues
29
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
桦生 詹
willdesk_apiauto
Commits
cf430e35
Commit
cf430e35
authored
Mar 12, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化clientId
parent
999ac4c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
conftest.py
conftest.py
+8
-5
No files found.
conftest.py
View file @
cf430e35
...
@@ -7,9 +7,7 @@ from Utils import config_handler
...
@@ -7,9 +7,7 @@ from Utils import config_handler
from
Utils
import
global_variate
from
Utils
import
global_variate
from
Utils
import
websocket_handler
from
Utils
import
websocket_handler
session
=
requests
.
session
()
session
=
requests
.
session
()
def
willdesk_login
():
def
willdesk_login
():
'''
'''
执行用例前获取登录态的接口,全局只执行一次,通过env参数控制是否测试环境
执行用例前获取登录态的接口,全局只执行一次,通过env参数控制是否测试环境
...
@@ -93,7 +91,6 @@ def customer_login():
...
@@ -93,7 +91,6 @@ def customer_login():
setattr
(
global_variate
.
Global
,
'customerName'
,
login_res
[
'data'
][
'name'
])
setattr
(
global_variate
.
Global
,
'customerName'
,
login_res
[
'data'
][
'name'
])
address
=
'wss://atestws.sealapps.com/ws'
if
env
==
'test'
else
'wss://ws.willdesk.com/ws'
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
())
}
'
)
print
(
f
'
{
address
}
?platform=1&authorization=
{
global_variate
.
Global
.
access_token
}
&t=
{
int
(
time
.
time
())
}
'
)
websocket_handler
.
ws_willdesk
=
websocket_handler
.
ws
(
websocket_handler
.
ws_willdesk
=
websocket_handler
.
ws
(
url
=
f
'
{
address
}
?platform=1&authorization=
{
global_variate
.
Global
.
access_token
}
&t=
{
int
(
time
.
time
())
}
'
,
url
=
f
'
{
address
}
?platform=1&authorization=
{
global_variate
.
Global
.
access_token
}
&t=
{
int
(
time
.
time
())
}
'
,
attr
=
'willdesk'
)
# willdesk账号websocket链接
attr
=
'willdesk'
)
# willdesk账号websocket链接
...
@@ -103,13 +100,19 @@ def customer_login():
...
@@ -103,13 +100,19 @@ def customer_login():
async
def
close_ws
():
async
def
close_ws
():
await
asyncio
.
gather
(
asyncio
.
create_task
(
websocket_handler
.
ws_willdesk
.
close
()),
asyncio
.
create_task
(
websocket_handler
.
ws_client
.
close
()))
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
)
@
pytest
.
fixture
(
scope
=
'session'
,
autouse
=
True
)
def
call_fixture
():
def
call_fixture
():
#自定义调用顺序
#自定义调用顺序
willdesk_login
()
willdesk_login
()
customer_login
()
customer_login
()
loop
.
run_until_complete
(
get_client_id
())
#初始化获取clientid
yield
yield
loop
=
websocket_handler
.
loop
loop
.
run_until_complete
(
close_ws
())
#关闭服务
loop
.
run_until_complete
(
close_ws
())
loop
.
stop
()
loop
.
stop
()
loop
.
close
()
loop
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment