Commit 435b4ba3 authored by liangfenglong's avatar liangfenglong

更新

parent 4811c05d
...@@ -39,7 +39,7 @@ SEND_MSG_TIME = 6 ...@@ -39,7 +39,7 @@ SEND_MSG_TIME = 6
# 搜索关键字 # 搜索关键字
EMPUTY = '' EMPUTY = ''
PROJECT_NAME = '双眼皮' PROJECT_NAME = '双眼皮'
HOSPITAL_NAME = '凯瑞婷' HOSPITAL_NAME = '美莱'
# 执行顺序,空出来 一些数字 # 执行顺序,空出来 一些数字
SEARCH_ORER = 100 SEARCH_ORER = 100
......
...@@ -11,7 +11,7 @@ class LiveCase(unittest.TestCase): ...@@ -11,7 +11,7 @@ class LiveCase(unittest.TestCase):
''' '''
channel_id = None channel_id = None
stream_id = None stream_id = None
service_ids = None service_ids = [5818403,588996,618573,510192] #单独的先写死
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
...@@ -92,6 +92,7 @@ class LiveCase(unittest.TestCase): ...@@ -92,6 +92,7 @@ class LiveCase(unittest.TestCase):
return not r['data']['stream_status']['is_finish'] return not r['data']['stream_status']['is_finish']
@classmethod @classmethod
@require_login(settings.LIVE_USER)
def live_services(cls): def live_services(cls):
uri = '/api/janus/live/live_services' uri = '/api/janus/live/live_services'
url = settings.BACKEND_ADMIN + uri url = settings.BACKEND_ADMIN + uri
......
...@@ -27,7 +27,6 @@ class LiveAddService(LiveCase): ...@@ -27,7 +27,6 @@ class LiveAddService(LiveCase):
rep = requests.post(self.url, data=self.data).json() rep = requests.post(self.url, data=self.data).json()
self.assertEqual(rep['error'], 0, rep) self.assertEqual(rep['error'], 0, rep)
self.assertEqual(rep['data']['toast'], '成功添加1件商品', rep) self.assertEqual(rep['data']['toast'], '成功添加1件商品', rep)
print('主播添加单个美购成功!') print('主播添加单个美购成功!')
@pytest.mark.post @pytest.mark.post
...@@ -38,8 +37,8 @@ class LiveAddService(LiveCase): ...@@ -38,8 +37,8 @@ class LiveAddService(LiveCase):
主播添加多个美购 主播添加多个美购
''' '''
import random import random
num = random.choice(range(2, 10)) # 2-9个先写死 num = random.choice(range(2, 4)) # 2-9个先写死
self.data.update(service_item_ids=','.join(LiveCase.service_ids[-num:])) self.data.update(service_item_ids=','.join(map(str, LiveCase.service_ids[-num:])))
rep = requests.post(self.url, data=self.data).json() rep = requests.post(self.url, data=self.data).json()
self.assertEqual(rep['error'], 0, rep) self.assertEqual(rep['error'], 0, rep)
self.assertEqual(rep['data']['toast'], f'成功添加{num}件商品', rep) self.assertEqual(rep['data']['toast'], f'成功添加{num}件商品', rep)
......
...@@ -23,6 +23,7 @@ class LiveSearchService(LiveCase): ...@@ -23,6 +23,7 @@ class LiveSearchService(LiveCase):
@pytest.mark.get @pytest.mark.get
@pytest.mark.run(order=settings.SEARCH_ORER) @pytest.mark.run(order=settings.SEARCH_ORER)
@data(*[settings.EMPUTY, settings.PROJECT_NAME, settings.HOSPITAL_NAME]) @data(*[settings.EMPUTY, settings.PROJECT_NAME, settings.HOSPITAL_NAME])
@require_login(settings.LIVE_USER)
def test_live_search_service(self, value): def test_live_search_service(self, value):
''' '''
直播间搜索美购 直播间搜索美购
...@@ -36,11 +37,11 @@ class LiveSearchService(LiveCase): ...@@ -36,11 +37,11 @@ class LiveSearchService(LiveCase):
self.assertIsInstance(services, list, rep) self.assertIsInstance(services, list, rep)
if q != settings.EMPUTY: if q != settings.EMPUTY:
# 防止数据较少情况,仅对前两条进行判断 # 防止数据较少情况,仅对前两条进行判断
[self.assertIn(q, item['service_name'] + item['hospital_name']) for item in services[:2]] [self.assertIn(q, item['service_name'] + item['hospital_name'], item) for item in services[:2]]
# 对 外显的价格 销量和距离进行关键字断言 # 对 外显的价格 销量和距离进行关键字断言
[self.assertNotEqual(item['display_price'], '') for item in services] [self.assertNotEqual(item['display_price'], '', item) for item in services]
[self.assertNotEqual(item['distance'], '') for item in services] [self.assertNotEqual(item['distance'], '', item) for item in services]
[self.assertNotEqual(item['sell_num_desc'], '') for item in services] [self.assertNotEqual(item['sell_num_desc'], '', item) for item in services]
if q == settings.EMPUTY: if q == settings.EMPUTY:
LiveCase.service_ids = [item['service_id'] for item in services] LiveCase.service_ids = [item['service_item_id'] for item in services]
print('直播间搜索美购成功!') print('直播间搜索美购成功!')
import requests
import pytest import pytest
from utils.gmhttp import require_login
from .livecase import LiveCase from .livecase import LiveCase
from conf import settings
class LiveServices(LiveCase): class LiveServices(LiveCase):
'''获取直播间美购列表''' '''获取直播间美购列表'''
@pytest.mark.get @pytest.mark.get
@require_login(settings.LIVE_USER)
def test_live_services(self): def test_live_services(self):
''' '''
获取直播间美购列表 获取直播间美购列表
......
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