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
7f0f13f2
Commit
7f0f13f2
authored
Jan 12, 2021
by
杨彦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add follow
parent
bbd09a28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
2 deletions
+105
-2
AutoApiTest.iml
.idea/AutoApiTest.iml
+8
-0
workspace.xml
.idea/workspace.xml
+0
-0
settings.py
conf/settings.py
+5
-2
livecase.py
testCase/live/livecase.py
+46
-0
test_user_follow.py
testCase/live/test_user_follow.py
+24
-0
test_user_unfollow.py
testCase/live/test_user_unfollow.py
+22
-0
No files found.
.idea/AutoApiTest.iml
View file @
7f0f13f2
...
@@ -5,4 +5,11 @@
...
@@ -5,4 +5,11 @@
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</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>
</module>
\ No newline at end of file
.idea/workspace.xml
View file @
7f0f13f2
This diff is collapsed.
Click to expand it.
conf/settings.py
View file @
7f0f13f2
...
@@ -47,4 +47,7 @@ ADD_SERVICE_ONE_ORER = 201
...
@@ -47,4 +47,7 @@ ADD_SERVICE_ONE_ORER = 201
ADD_SERVICE_MANY_ORER
=
202
ADD_SERVICE_MANY_ORER
=
202
MARK_SERVICE
=
301
MARK_SERVICE
=
301
UNDO_MARK_SERVICE
=
302
UNDO_MARK_SERVICE
=
302
DELETE_SERVICE_ORER
=
401
DELETE_SERVICE_ORER
=
401
\ No newline at end of file
USER_FOLLOW_ADD
=
500
USER_FOLLOW_DEL
=
501
\ No newline at end of file
testCase/live/livecase.py
View file @
7f0f13f2
...
@@ -12,6 +12,9 @@ class LiveCase(unittest.TestCase):
...
@@ -12,6 +12,9 @@ class LiveCase(unittest.TestCase):
channel_id
=
None
channel_id
=
None
stream_id
=
None
stream_id
=
None
service_ids
=
[
5818403
,
588996
,
618573
,
510192
]
#单独的先写死
service_ids
=
[
5818403
,
588996
,
618573
,
510192
]
#单独的先写死
user_id
=
None
is_following
=
None
@classmethod
@classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
...
@@ -24,10 +27,13 @@ class LiveCase(unittest.TestCase):
...
@@ -24,10 +27,13 @@ class LiveCase(unittest.TestCase):
cls
.
host
=
settings
.
BACKEND_ADMIN
cls
.
host
=
settings
.
BACKEND_ADMIN
cls
.
create_live
()
cls
.
create_live
()
cls
.
stream_info
()
cls
.
stream_info
()
cls
.
follow_status
()
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
cls
.
close_live
()
cls
.
close_live
()
# cls.user_follow_del()
@classmethod
@classmethod
@require_login
@require_login
...
@@ -81,6 +87,8 @@ class LiveCase(unittest.TestCase):
...
@@ -81,6 +87,8 @@ class LiveCase(unittest.TestCase):
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
cls
.
stream_id
=
r
[
'data'
][
'id'
]
cls
.
stream_id
=
r
[
'data'
][
'id'
]
@classmethod
@classmethod
def
live_status
(
cls
):
def
live_status
(
cls
):
if
not
cls
.
stream_id
:
if
not
cls
.
stream_id
:
...
@@ -91,6 +99,42 @@ class LiveCase(unittest.TestCase):
...
@@ -91,6 +99,42 @@ class LiveCase(unittest.TestCase):
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
return
not
r
[
'data'
][
'stream_status'
][
'is_finish'
]
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
@classmethod
@require_login
(
settings
.
LIVE_USER
)
@require_login
(
settings
.
LIVE_USER
)
def
live_services
(
cls
):
def
live_services
(
cls
):
...
@@ -100,6 +144,8 @@ class LiveCase(unittest.TestCase):
...
@@ -100,6 +144,8 @@ class LiveCase(unittest.TestCase):
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
r
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
return
r
return
r
# @classmethod
# @classmethod
# def live_add_service(cls):
# def live_add_service(cls):
# uri = '/api/janus/live/add_live_service'
# uri = '/api/janus/live/add_live_service'
...
...
testCase/live/test_user_follow.py
0 → 100644
View file @
7f0f13f2
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
(
"用户当前已经是关注状态"
)
testCase/live/test_user_unfollow.py
0 → 100644
View file @
7f0f13f2
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
(
"用户当前非关注状态"
)
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