Commit 88c644d1 authored by liangfenglong's avatar liangfenglong

更新增加 频繁发送弹幕限制

parent 31d33184
......@@ -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
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