Commit 3c4b6a37 authored by liangfenglong's avatar liangfenglong

更新

parent a92940e9
import unittest import unittest
import requests import requests
from conf import settings
from utils.gmhttp import require_login from utils.gmhttp import require_login
class LiveCase(unittest.TestCase): class LiveCase(unittest.TestCase):
live_id = None
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
...@@ -17,6 +18,9 @@ class LiveCase(unittest.TestCase): ...@@ -17,6 +18,9 @@ class LiveCase(unittest.TestCase):
''' '''
cls.create_live() cls.create_live()
@classmethod
def tearDownClass(cls):
cls.close_live()
@classmethod @classmethod
@require_login @require_login
...@@ -25,9 +29,20 @@ class LiveCase(unittest.TestCase): ...@@ -25,9 +29,20 @@ class LiveCase(unittest.TestCase):
创建直播间 创建直播间
:return: :return:
''' '''
r = requests.post('xxx').json() uri = '/api/live/push_live_info'
url = settings.BACKEND_ADMIN + uri
cls.live_id = r[''] params = settings.GENGMEI_PARAMS.update(
{
'notice': '哈哈哈哈',
'tag_id': 3161,
'title': '测试',
'cover_url': '2021/01/04/1506/ba72d863e638',
'device_type': 1
}
)
r = requests.get(url, params=params).json()
cls.live_id = r['data']['channel']
@classmethod @classmethod
@require_login @require_login
...@@ -36,6 +51,9 @@ class LiveCase(unittest.TestCase): ...@@ -36,6 +51,9 @@ class LiveCase(unittest.TestCase):
关闭直播间 关闭直播间
:return: :return:
''' '''
r = requests.post('xxx').json() uri = '/api/live/finish'
url = settings.BACKEND_ADMIN + uri
print('关闭直播间成功!') data = {'channel_id': cls.live_id}
\ No newline at end of file r = requests.post(url, data=data).json()
if r['error'] == 0:
print('关闭直播间成功!')
import unittest
import requests import requests
from utils.gmhttp import require_login from utils.gmhttp import require_login
from .livecase import LiveCase
class LiveXXX(unittest.TestCase): class LiveXXX(LiveCase):
@require_login @require_login
def test_xxx(self): def test_xxx(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