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
435b4ba3
Commit
435b4ba3
authored
Jan 08, 2021
by
liangfenglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
4811c05d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
11 deletions
+16
-11
settings.py
conf/settings.py
+1
-1
livecase.py
testCase/live/livecase.py
+2
-1
test_live_add_service.py
testCase/live/test_live_add_service.py
+2
-3
test_live_search_service.py
testCase/live/test_live_search_service.py
+6
-5
test_live_services.py
testCase/live/test_live_services.py
+5
-1
No files found.
conf/settings.py
View file @
435b4ba3
...
...
@@ -39,7 +39,7 @@ SEND_MSG_TIME = 6
# 搜索关键字
EMPUTY
=
''
PROJECT_NAME
=
'双眼皮'
HOSPITAL_NAME
=
'
凯瑞婷
'
HOSPITAL_NAME
=
'
美莱
'
# 执行顺序,空出来 一些数字
SEARCH_ORER
=
100
...
...
testCase/live/livecase.py
View file @
435b4ba3
...
...
@@ -11,7 +11,7 @@ class LiveCase(unittest.TestCase):
'''
channel_id
=
None
stream_id
=
None
service_ids
=
None
service_ids
=
[
5818403
,
588996
,
618573
,
510192
]
#单独的先写死
@classmethod
def
setUpClass
(
cls
):
...
...
@@ -92,6 +92,7 @@ class LiveCase(unittest.TestCase):
return
not
r
[
'data'
][
'stream_status'
][
'is_finish'
]
@classmethod
@require_login
(
settings
.
LIVE_USER
)
def
live_services
(
cls
):
uri
=
'/api/janus/live/live_services'
url
=
settings
.
BACKEND_ADMIN
+
uri
...
...
testCase/live/test_live_add_service.py
View file @
435b4ba3
...
...
@@ -27,7 +27,6 @@ class LiveAddService(LiveCase):
rep
=
requests
.
post
(
self
.
url
,
data
=
self
.
data
)
.
json
()
self
.
assertEqual
(
rep
[
'error'
],
0
,
rep
)
self
.
assertEqual
(
rep
[
'data'
][
'toast'
],
'成功添加1件商品'
,
rep
)
print
(
'主播添加单个美购成功!'
)
@pytest.mark.post
...
...
@@ -38,8 +37,8 @@ class LiveAddService(LiveCase):
主播添加多个美购
'''
import
random
num
=
random
.
choice
(
range
(
2
,
10
))
# 2-9个先写死
self
.
data
.
update
(
service_item_ids
=
','
.
join
(
LiveCase
.
service_ids
[
-
num
:]
))
num
=
random
.
choice
(
range
(
2
,
4
))
# 2-9个先写死
self
.
data
.
update
(
service_item_ids
=
','
.
join
(
map
(
str
,
LiveCase
.
service_ids
[
-
num
:])
))
rep
=
requests
.
post
(
self
.
url
,
data
=
self
.
data
)
.
json
()
self
.
assertEqual
(
rep
[
'error'
],
0
,
rep
)
self
.
assertEqual
(
rep
[
'data'
][
'toast'
],
f
'成功添加{num}件商品'
,
rep
)
...
...
testCase/live/test_live_search_service.py
View file @
435b4ba3
...
...
@@ -23,6 +23,7 @@ class LiveSearchService(LiveCase):
@pytest.mark.get
@pytest.mark.run
(
order
=
settings
.
SEARCH_ORER
)
@data
(
*
[
settings
.
EMPUTY
,
settings
.
PROJECT_NAME
,
settings
.
HOSPITAL_NAME
])
@require_login
(
settings
.
LIVE_USER
)
def
test_live_search_service
(
self
,
value
):
'''
直播间搜索美购
...
...
@@ -36,11 +37,11 @@ class LiveSearchService(LiveCase):
self
.
assertIsInstance
(
services
,
list
,
rep
)
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
[
'distance'
],
''
)
for
item
in
services
]
[
self
.
assertNotEqual
(
item
[
'sell_num_desc'
],
''
)
for
item
in
services
]
[
self
.
assertNotEqual
(
item
[
'display_price'
],
''
,
item
)
for
item
in
services
]
[
self
.
assertNotEqual
(
item
[
'distance'
],
''
,
item
)
for
item
in
services
]
[
self
.
assertNotEqual
(
item
[
'sell_num_desc'
],
''
,
item
)
for
item
in
services
]
if
q
==
settings
.
EMPUTY
:
LiveCase
.
service_ids
=
[
item
[
'service_id'
]
for
item
in
services
]
LiveCase
.
service_ids
=
[
item
[
'service_i
tem_i
d'
]
for
item
in
services
]
print
(
'直播间搜索美购成功!'
)
testCase/live/test_live_services.py
View file @
435b4ba3
import
requests
import
pytest
from
utils.gmhttp
import
require_login
from
.livecase
import
LiveCase
from
conf
import
settings
class
LiveServices
(
LiveCase
):
'''获取直播间美购列表'''
@pytest.mark.get
@require_login
(
settings
.
LIVE_USER
)
def
test_live_services
(
self
):
'''
获取直播间美购列表
...
...
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