Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AutoApiTest
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
business
AutoApiTest
Commits
88c644d1
Commit
88c644d1
authored
Jan 05, 2021
by
liangfenglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新增加 频繁发送弹幕限制
parent
31d33184
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
test_live_sendmsg.py
testCase/live/test_live_sendmsg.py
+19
-0
No files found.
testCase/live/test_live_sendmsg.py
View file @
88c644d1
...
...
@@ -54,3 +54,21 @@ class LiveSendMsg(LiveCase):
self
.
assertEqual
(
rep
[
'error_code'
],
96604
,
rep
)
self
.
assertEqual
(
rep
[
'message'
],
'您输入的内容包含敏感信息,请重新输入'
,
rep
)
print
(
'敏感词拦截成功!'
)
@require_login
(
settings
.
LIVE_WATCHER
)
def
test_live_sendmsg_interval
(
self
):
'''
频繁发送弹幕的限制,这里只做单个人的限制验证,其他case已覆盖不同用户的误限制验证
'''
# 不管这条在前还是在后,直接先等个时间
import
time
time
.
sleep
(
settings
.
SEND_MSG_TIME
)
requests
.
post
(
self
.
url
,
data
=
self
.
data
)
.
json
()
rep
=
requests
.
post
(
self
.
url
,
data
=
self
.
data
)
.
json
()
self
.
assertEqual
(
rep
[
'error_code'
],
13
,
rep
)
self
.
assertEqual
(
rep
[
'message'
],
'您发送弹幕过于频繁了,请稍后再试'
,
rep
)
print
(
'频繁发送限制成功!'
)
time
.
sleep
(
settings
.
SEND_MSG_TIME
)
rep
=
requests
.
post
(
self
.
url
,
data
=
self
.
data
)
.
json
()
self
.
assertEqual
(
rep
[
'error'
],
0
,
rep
)
print
(
f
'间隔{settings.SEND_MSG_TIME}时间后发送弹幕成功!'
)
\ No newline at end of file
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