Commit 7f0f13f2 authored by 杨彦's avatar 杨彦

add follow

parent bbd09a28
......@@ -5,4 +5,11 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>
\ No newline at end of file
......@@ -19,7 +19,14 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="141eb6db-995b-4153-87ad-863d77d8f4a9" name="Default Changelist" comment="" />
<list default="true" id="141eb6db-995b-4153-87ad-863d77d8f4a9" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/testCase/live/test_user_follow.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/testCase/live/test_user_unfollow.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/AutoApiTest.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/AutoApiTest.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/conf/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/conf/settings.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/testCase/live/livecase.py" beforeDir="false" afterPath="$PROJECT_DIR$/testCase/live/livecase.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
......@@ -53,7 +60,7 @@
<recent name="$PROJECT_DIR$/testCase/live" />
</key>
</component>
<component name="RunManager" selected="Python tests.pytest for live.test_live_polling.LivePolling.test_live_polling_visitor">
<component name="RunManager" selected="Python tests.pytest for live.test_user_follow.LiveUserFollow.test_live_follow_user">
<configuration name="pytest for live.test_live_polling.LivePolling.test_live_polling_visitor" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="AutoApiTest" />
<option name="INTERPRETER_OPTIONS" value="" />
......@@ -86,8 +93,59 @@
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for live.test_user_follow.LiveUserFollow.test_live_follow_user" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="AutoApiTest" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testCase" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;live.test_user_follow.LiveUserFollow.test_live_follow_user&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for live.test_user_unfollow.LiveUserUnFollow.test_live_follow_user" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="AutoApiTest" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testCase" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;live.test_user_unfollow.LiveUserUnFollow.test_live_follow_user&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for live.test_user_unfollow.LiveUserUnFollow.test_live_unfollow_user" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="AutoApiTest" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/testCase" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;live.test_user_unfollow.LiveUserUnFollow.test_live_unfollow_user&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.pytest for live.test_user_follow.LiveUserFollow.test_live_follow_user" />
<item itemvalue="Python tests.pytest for live.test_user_unfollow.LiveUserUnFollow.test_live_unfollow_user" />
<item itemvalue="Python tests.pytest for live.test_user_unfollow.LiveUserUnFollow.test_live_follow_user" />
<item itemvalue="Python tests.pytest for live.test_live_polling.LivePolling.test_live_polling_visitor" />
<item itemvalue="Python tests.pytest for live.test_live_sendmsg.LiveSendMsg.test_live_sendmsg_visitor" />
</list>
......@@ -120,26 +178,46 @@
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state width="1371" height="373" key="GridCell.Tab.0.bottom" timestamp="1610018868443">
<screen x="0" y="23" width="1402" height="877" />
<state width="1371" height="197" key="GridCell.Tab.0.bottom" timestamp="1610436409868">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="197" key="GridCell.Tab.0.bottom/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436409868" />
<state width="1371" height="373" key="GridCell.Tab.0.bottom/0.23.1402.877/-190.-1057.1920.1057@0.23.1402.877" timestamp="1610018868443" />
<state width="1371" height="373" key="GridCell.Tab.0.bottom/0.23.1403.877/-190.-1057.1920.1057@0.23.1403.877" timestamp="1610002487290" />
<state width="1371" height="373" key="GridCell.Tab.0.center" timestamp="1610018868443">
<screen x="0" y="23" width="1402" height="877" />
<state width="1371" height="197" key="GridCell.Tab.0.center" timestamp="1610436409867">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="197" key="GridCell.Tab.0.center/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436409867" />
<state width="1371" height="373" key="GridCell.Tab.0.center/0.23.1402.877/-190.-1057.1920.1057@0.23.1402.877" timestamp="1610018868443" />
<state width="1371" height="373" key="GridCell.Tab.0.center/0.23.1403.877/-190.-1057.1920.1057@0.23.1403.877" timestamp="1610002487288" />
<state width="1371" height="373" key="GridCell.Tab.0.left" timestamp="1610018868442">
<screen x="0" y="23" width="1402" height="877" />
<state width="1371" height="197" key="GridCell.Tab.0.left" timestamp="1610436409867">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="197" key="GridCell.Tab.0.left/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436409867" />
<state width="1371" height="373" key="GridCell.Tab.0.left/0.23.1402.877/-190.-1057.1920.1057@0.23.1402.877" timestamp="1610018868442" />
<state width="1371" height="373" key="GridCell.Tab.0.left/0.23.1403.877/-190.-1057.1920.1057@0.23.1403.877" timestamp="1610002487286" />
<state width="1371" height="373" key="GridCell.Tab.0.right" timestamp="1610018868443">
<screen x="0" y="23" width="1402" height="877" />
<state width="1371" height="197" key="GridCell.Tab.0.right" timestamp="1610436409868">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="197" key="GridCell.Tab.0.right/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436409868" />
<state width="1371" height="373" key="GridCell.Tab.0.right/0.23.1402.877/-190.-1057.1920.1057@0.23.1402.877" timestamp="1610018868443" />
<state width="1371" height="373" key="GridCell.Tab.0.right/0.23.1403.877/-190.-1057.1920.1057@0.23.1403.877" timestamp="1610002487288" />
<state width="1371" height="383" key="GridCell.Tab.1.bottom" timestamp="1610436414738">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="383" key="GridCell.Tab.1.bottom/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436414738" />
<state width="1371" height="383" key="GridCell.Tab.1.center" timestamp="1610436414737">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="383" key="GridCell.Tab.1.center/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436414737" />
<state width="1371" height="383" key="GridCell.Tab.1.left" timestamp="1610436414737">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="383" key="GridCell.Tab.1.left/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436414737" />
<state width="1371" height="383" key="GridCell.Tab.1.right" timestamp="1610436414738">
<screen x="0" y="23" width="1400" height="877" />
</state>
<state width="1371" height="383" key="GridCell.Tab.1.right/0.23.1400.877/-190.-1057.1920.1057@0.23.1400.877" timestamp="1610436414738" />
<state x="530" y="192" key="RollbackChangesDialog" timestamp="1610417817243">
<screen x="0" y="23" width="1400" height="877" />
</state>
......@@ -151,4 +229,40 @@
<state x="61" y="97" key="SettingsEditor/0.23.1403.877/-190.-1057.1920.1057@0.23.1403.877" timestamp="1610016494003" />
<state x="61" y="97" key="SettingsEditor/0.23.1404.877/-190.-1057.1920.1057@0.23.1404.877" timestamp="1610012460068" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/test_user_unfollow.py</url>
<line>17</line>
<option name="timeStamp" value="10" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/test_user_follow.py</url>
<line>12</line>
<option name="timeStamp" value="14" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/test_user_follow.py</url>
<line>15</line>
<option name="timeStamp" value="15" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/test_user_unfollow.py</url>
<line>14</line>
<option name="timeStamp" value="16" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/test_user_unfollow.py</url>
<line>19</line>
<option name="timeStamp" value="17" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/testCase/live/livecase.py</url>
<line>110</line>
<option name="timeStamp" value="18" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>
\ No newline at end of file
......@@ -47,4 +47,7 @@ ADD_SERVICE_ONE_ORER = 201
ADD_SERVICE_MANY_ORER = 202
MARK_SERVICE = 301
UNDO_MARK_SERVICE = 302
DELETE_SERVICE_ORER = 401
\ No newline at end of file
DELETE_SERVICE_ORER = 401
USER_FOLLOW_ADD=500
USER_FOLLOW_DEL=501
\ No newline at end of file
......@@ -12,6 +12,9 @@ class LiveCase(unittest.TestCase):
channel_id = None
stream_id = None
service_ids = [5818403,588996,618573,510192] #单独的先写死
user_id=None
is_following=None
@classmethod
def setUpClass(cls):
......@@ -24,10 +27,13 @@ class LiveCase(unittest.TestCase):
cls.host = settings.BACKEND_ADMIN
cls.create_live()
cls.stream_info()
cls.follow_status()
@classmethod
def tearDownClass(cls):
cls.close_live()
# cls.user_follow_del()
@classmethod
@require_login
......@@ -81,6 +87,8 @@ class LiveCase(unittest.TestCase):
r = requests.get(url, params=params).json()
cls.stream_id = r['data']['id']
@classmethod
def live_status(cls):
if not cls.stream_id:
......@@ -91,6 +99,42 @@ class LiveCase(unittest.TestCase):
r = requests.get(url, params=params).json()
return not r['data']['stream_status']['is_finish']
@classmethod
#@require_login(settings.LIVE_WATCHER)
def follow_status(cls):
if not cls.channel_id:
return
uri = '/api/live/get_live_info/audience'
url = settings.BACKEND_ADMIN + uri
params = dict(settings.GENGMEI_PARAMS, channel_id=cls.channel_id)
r = requests.get(url, params=params).json()
cls.is_following = r['data']['is_following']
cls.user_id = r['data']['user_id']
@classmethod
#@require_login(settings.LIVE_WATCHER)
def user_follow_add(cls):
uri='/api/user/follow/add'
url=settings.BACKEND_ADMIN+uri
data = {
"from_live":cls.stream_id,
"uid":cls.user_id
}
r=requests.post(url,data=data).json()
return r
@classmethod
#@require_login(settings.LIVE_WATCHER)
def user_follow_del(cls):
uri='/api/user/follow/del'
url=settings.BACKEND_ADMIN+uri
data = {
"uid":cls.user_id
}
r=requests.post(url,data=data).json()
return r
@classmethod
@require_login(settings.LIVE_USER)
def live_services(cls):
......@@ -100,6 +144,8 @@ class LiveCase(unittest.TestCase):
r = requests.get(url, params=params).json()
return r
# @classmethod
# def live_add_service(cls):
# uri = '/api/janus/live/add_live_service'
......
import requests
from utils.gmhttp import require_login
from .livecase import LiveCase
from conf import settings
import pytest
class LiveUserFollow(LiveCase):
# @pytest.mark.run(order=settings.USER_FOLLOW_ADD)
@require_login(settings.LIVE_WATCHER)
def test_live_follow_user(self):
'''
用户关注主播
'''
if self.is_following==False:
r = self.user_follow_add()
self.assertEqual(r['error'], 0, r)
print("用户关注主播成功")
else:
print("用户当前已经是关注状态")
import requests
from utils.gmhttp import require_login
from .livecase import LiveCase
from conf import settings
import pytest
class LiveUserUnFollow(LiveCase):
# @pytest.mark.run(order=settings.USER_FOLLOW_DEL)
@require_login(settings.LIVE_WATCHER)
def test_live_unfollow_user(self):
'''
用户关注主播
'''
if self.is_following==True:
r = self.user_follow_del()
self.assertEqual(r['error'], 0, r)
print("用户取消关注成功")
else:
print("用户当前非关注状态")
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