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
3ff7481c
Commit
3ff7481c
authored
Mar 08, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改动断言方式
parent
84731b0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
Utils/websocket_handler.py
Utils/websocket_handler.py
+15
-4
No files found.
Utils/websocket_handler.py
View file @
3ff7481c
...
@@ -5,7 +5,7 @@ from Utils.global_variate import Global
...
@@ -5,7 +5,7 @@ from Utils.global_variate import Global
from
TestData.inbox.livechat_test_data
import
livechatData
from
TestData.inbox.livechat_test_data
import
livechatData
loop
=
asyncio
.
get_event_loop
()
#异步主线
loop
=
asyncio
.
get_event_loop
()
#异步主线
loop
.
set_debug
(
True
)
class
ws
:
class
ws
:
def
__init__
(
self
,
url
,
attr
):
def
__init__
(
self
,
url
,
attr
):
...
@@ -83,8 +83,19 @@ async def ws_action(ws,case):
...
@@ -83,8 +83,19 @@ async def ws_action(ws,case):
action
=
case
[
'action'
]
#操作
action
=
case
[
'action'
]
#操作
if
action
==
'sendmsg'
:
if
action
==
'sendmsg'
:
response
=
await
ws_send_handler
(
case
=
case
,
ws
=
ws
)
response
=
await
ws_send_handler
(
case
=
case
,
ws
=
ws
)
if
response
.
get
(
'code'
):
assert
response
[
'code'
]
==
200
else
:
assert
response
[
'response'
][
'code'
]
==
200
assert
response
[
'response'
][
'code'
]
==
200
assert
response
[
'action'
]
==
'sendmsg'
# type = case['data']['type']
# if type in ['emoji','file','link','rate','product']:
# if type not in ['file','rate','emoji']: #type等于file的时候,后端返回的action,willdesk端是sendmsg,c端又是readMsg,干脆不作判断了
# assert response['data']['action'] == 'sendmsg'
#
# else:
# assert response['response']['code'] == 200
# assert response['action'] == 'sendmsg'
elif
action
==
'receive'
:
elif
action
==
'receive'
:
expected
=
case
[
'expected'
]
# 断言
expected
=
case
[
'expected'
]
# 断言
...
@@ -189,7 +200,7 @@ async def ws_run(ws,case):
...
@@ -189,7 +200,7 @@ async def ws_run(ws,case):
:param case: 传入用例数据
:param case: 传入用例数据
'''
'''
# asyncio.run(ws_action(ws=ws,case=case))
# asyncio.run(ws_action(ws=ws,case=case))
task
=
asyncio
.
ensure_future
(
ws_action
(
ws
=
ws
,
case
=
case
))
task
=
asyncio
.
create_task
(
ws_action
(
ws
=
ws
,
case
=
case
))
await
asyncio
.
wait_for
(
task
,
timeout
=
10
)
await
asyncio
.
wait_for
(
task
,
timeout
=
10
)
# loop.run_until_complete(ws_action(ws=ws,case=case))
# loop.run_until_complete(ws_action(ws=ws,case=case))
...
...
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