Commit 79e7cd41 authored by aha's avatar aha

zhibo

parent 307e911c
import path_setting
from in_common.base_request import BaseRequest
class live_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.LIVESERVICES_CONFIG)
self.data = self.api_load(path_setting.LIVEGIFTS_CONFIG)
self.data = self.api_load(path_setting.SEARCHSERVICE_CONFIG)
self.data = self.api_load(path_setting.ADDLIVESERVICE_CONFIG)
self.data = self.api_load(path_setting.DELETELIVESERVICE_CONFIG)
self.data = self.api_load(path_setting.DELETEGIFT_CONFIG)
#主播-推荐袋美购列表展示
def live_services(self, channel_id, stream_id, offset, size):
self.params["channel_id"] = channel_id
self.params["stream_id"] = stream_id
self.params["offset"] = offset
self.params["size"] = size
return self.api_send(self.data["live_services"])
#主播-推荐袋美券列表展示
def live_gifts(self, channel_id, gift_type, stream_id, offset, size):
self.params["channel_id"] = channel_id
self.params["gift_type"] = gift_type
self.params["stream_id"] = stream_id
self.params["offset"] = offset
self.params["size"] = size
return self.api_send(self.data["live_gifts"])
#主播-推荐袋商品捜索功能
def search_service(self, current_city_id, channel_id, query, offset, size, version, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["current_city_id"] = current_city_id
self.params["channel_id"] = channel_id
self.params["query"] = query
self.params["offset"] = offset
self.params["size"] = size
self.params["version"] = version
return self.api_send(self.data["search_service"])
#主播-推荐袋美券捜索功能
def search_gifts(self, current_city_id, channel_id, gift_type, offset, size, version, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["current_city_id"] = current_city_id
self.params["channel_id"] = channel_id
self.params["gift_type"] = gift_type
self.params["offset"] = offset
self.params["size"] = size
self.params["version"] = version
return self.api_send(self.data["search_gifts"])
#主播-推荐袋添加商品
def add_live_service(self, channel_id, service_item_ids, version, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["channel_id"] = channel_id
self.params["service_item_ids"] = service_item_ids
self.params["version"] = version
return self.api_send(self.data["add_live_service"])
#主播-推荐袋删除商品
def delete_live_service(self, channel_id, live_service_id, version, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["channel_id"] = channel_id
self.params["live_service_id"] = live_service_id
self.params["version"] = version
return self.api_send(self.data["delete_live_service"])
#主播-推荐袋删除美券
def delete_live_gift(self, channel_id, gift_id, gift_type, stream_id, version, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["channel_id"] = channel_id
self.params["gift_id"] = gift_id
self.params["gift_type"] = gift_type
self.params["stream_id"] = stream_id
self.params["version"] = version
return self.api_send(self.data["delete_live_gift"])
if __name__ == '__main__':
print(live_request().live_services("745", "4177", "0", "10"))
print(live_request().search_service("beijing", "745", "", "0", "20", "7.45.0"))
print(live_request().add_live_service("745", "560641", "7.45.0"))
print(live_request().delete_live_service("745", "7242", "7.45.0"))
\ No newline at end of file
#主播-推荐袋美购列表展示
live_services:
method: GET
url: /api/janus/live/live_services
params:
channel_id: ${channel_id}
stream_id: ${stream_id}
offset: ${offset}
size: ${size}
data: {}
json: {}
isLogin: 1
#主播-推荐袋美券列表展示
live_gifts:
method: GET
url: /api/janus/live/live_gifts
params:
channel_id: ${channel_id}
gift_type: ${gift_type}
stream_id: ${stream_id}
offset: ${offset}
size: ${size}
data: {}
json: {}
isLogin: 1
#主播-推荐袋商品捜索功能
search_service:
method: GET
url: /api/janus/live/search_service
params:
current_city_id: ${current_city_id}
channel_id: ${channel_id}
query: ${query}
offset: ${offset}
size: ${size}
version: ${version}
data: {}
json: {}
isLogin: 1
#主播-推荐袋添加商品
add_live_service:
method: POST
url: /api/janus/live/add_live_service
params:
version: ${version}
data:
channel_id: ${channel_id}
service_item_ids: ${service_item_ids}
json: {}
isLogin: 1
#主播-推荐袋删除商品
delete_live_service:
method: POST
url: /api/janus/live/delete_live_service
params:
version: ${version}
data:
channel_id: ${channel_id}
live_service_id: ${live_service_id}
json: {}
isLogin: 1
#主播-推荐袋删除美券
delete_live_gift:
method: POST
url: /api/janus/live/delete_live_gift
params:
version: ${version}
data:
channel_id: ${channel_id}
gift_id: ${gift_id}
gift_type: ${gift_type}
stream_id: ${stream_id}
json: {}
isLogin: 1
...@@ -5,6 +5,7 @@ from in_common.base_request import BaseRequest ...@@ -5,6 +5,7 @@ from in_common.base_request import BaseRequest
class living_request(BaseRequest): class living_request(BaseRequest):
def __init__(self): def __init__(self):
self.data = self.api_load(path_setting.LIVEYAML_CONFIG) self.data = self.api_load(path_setting.LIVEYAML_CONFIG)
self.data = self.api_load(path_setting.LIVESERVICES_CONFIG)
#获取弹幕 #获取弹幕
def danmu_v2(self,channel_id,msg_id,user_id=""): def danmu_v2(self,channel_id,msg_id,user_id=""):
self.params["channel_id"] = channel_id self.params["channel_id"] = channel_id
...@@ -21,7 +22,27 @@ class living_request(BaseRequest): ...@@ -21,7 +22,27 @@ class living_request(BaseRequest):
self.params["device_type"] = device_type self.params["device_type"] = device_type
return self.api_send(self.data["pushlive_info"]) return self.api_send(self.data["pushlive_info"])
#主播-推荐袋美购列表展示
def live_services(self, channel_id, stream_id, offset, size):
self.params["channel_id"] = channel_id
self.params["stream_id"] = stream_id
self.params["offset"] = offset
self.params["size"] = size
return self.api_send(self.data["live_services"])
#主播-推荐袋商品捜索功能
def search_services(self, current_city_id, channel_id, query, offset, size, trace_id, device_id='97B6764B-2135-4761-9911-701C38CBC272'):
self.params["current_city_id"] = current_city_id
self.params["channel_id"] = channel_id
self.params["query"] = query
self.params["offset"] = offset
self.params["size"] = size
self.params["trace_id"] = trace_id
return self.api_send(self.data["search_services"])
if __name__ == '__main__': if __name__ == '__main__':
(living_request().danmu_v2("739", "1")) (living_request().danmu_v2("739", "1"))
(living_request().pushlive_info("小冤家", "2021/04/22/1003/cef471cff5e6", "", "1", "1", "1")) (living_request().pushlive_info("小冤家", "2021/04/22/1003/cef471cff5e6", "", "1", "1", "1"))
\ No newline at end of file print(living_request().live_services("745", "4177", "0", "10"))
print(living_request().search_services("beijing", "745", "", "0", "20", "2021/06/28/1750/9fc690d5e66f"))
\ No newline at end of file
...@@ -24,3 +24,32 @@ pushlive_info: ...@@ -24,3 +24,32 @@ pushlive_info:
json: {} json: {}
isLogin: 1 isLogin: 1
#主播-推荐袋美购列表展示
live_services:
method: GET
url: /api/janus/live/live_services
params:
channel_id: ${channel_id}
stream_id: ${stream_id}
offset: ${offset}
size: ${size}
data: {}
json: {}
isLogin: 1
#主播-推荐袋商品捜索功能
search_services:
method: GET
url: /api/janus/live/search_services
params:
current_city_id: ${current_city_id}
channel_id: ${channel_id}
query: ${query}
offset: ${offset}
size: ${size}
trace_id: ${trace_id}
data: {}
json: {}
isLogin: 1
develop_host: develop_host:
backend: http://backend.paas-develop.env backend: http://backend.paas-develop.env
# om: http://om.paas-develop.env om: http://om.paas-develop.env
# doctor: http://doctor.paas-develop.env # doctor: http://doctor.paas-develop.env
# backend: https://backend.igengmei.com # backend: https://backend.igengmei.com
...@@ -521,5 +521,33 @@ FREE_RECRUIT_LIST = os.path.join(BASE_DIR, "backend_auto/test_backend_data/feed_ ...@@ -521,5 +521,33 @@ FREE_RECRUIT_LIST = os.path.join(BASE_DIR, "backend_auto/test_backend_data/feed_
PAGE_RULES_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml") PAGE_RULES_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_request.yaml")
PAGE_RULES = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "page_rules.yaml") PAGE_RULES = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_data", "page_rules.yaml")
#主播-推荐袋美购列表展示
LIVESERVICES_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
LIVESERVICES = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "live_services.yaml")
#主播-推荐袋美券列表展示
LIVEGIFTS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
LIVEGIFTS = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "live_gifts.yaml")
#主播-推荐袋商品搜索功能
SEARCHSERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
SEARCHSERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "search_service.yaml")
#主播-推荐袋美券搜索功能
SEARCHGIFTS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
SEARCHGIFTS = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "search_gifts.yaml")
#主播-推荐袋添加商品
ADDLIVESERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
ADDLIVESERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "add_live_service.yaml")
#主播-推荐袋删除商品
DELETELIVESERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
DELETELIVESERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "delete_live_service.yaml")
#主播-推荐袋删除美券
DELETEGIFT_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "janus_live_request.yaml")
DELETEGIFT = os.path.join(BASE_DIR, "backend_auto/test_backend_data/janus_live_data", "delete_live_gift.yaml")
if __name__ == '__main__': if __name__ == '__main__':
print("==========",LIVEYAML_CONFIG) print("==========",LIVEYAML_CONFIG)
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestAddLiveService:
data = BaseRequest().api_load(path_setting.ADDLIVESERVICE)
addliveservice_case, addliveservice_data = get_ids(data, "add_live_service")
@pytest.mark.parametrize("param", addliveservice_data, ids=addliveservice_case)
def test_add_live_service(self, param):
print(111111111111111111111)
r = live_request().add_live_service(param["channel_id"], param["service_item_ids"], param["version"])
if r["error"] == 0:
assert r["data"]["toast"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestDeleteLiveGift:
data = BaseRequest().api_load(path_setting.DELETEGIFT)
deletelivegift_case, deletelivegift_data = get_ids(data, "delete_live_gift")
@pytest.mark.parametrize("param", deletelivegift_data, ids=deletelivegift_case)
def test_delete_live_gift(self, param):
print(111111111111111111111)
r = live_request().delete_live_gift(param["channel_id"], param["gift_id"], param["stream_id"], param["gift_type"], param["version"])
if r["error"] == 0:
assert r["data"]["toast"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestDeleteLiveService:
data = BaseRequest().api_load(path_setting.DELETELIVESERVICE)
deleteliveservice_case, deleteliveservice_data = get_ids(data, "delete_live_service")
@pytest.mark.parametrize("param", deleteliveservice_data, ids=deleteliveservice_case)
def test_delete_live_service(self, param):
print(111111111111111111111)
r = live_request().delete_live_service(param["channel_id"], param["live_service_id"], param["version"])
if r["error"] == 0:
assert r["data"]["toast"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestLiveGifts:
data = BaseRequest().api_load(path_setting.LIVEGIFTS)
livegifts_case, livegifts_data = get_ids(data, "live_gifts")
@pytest.mark.parametrize("param", livegifts_data, ids=livegifts_case)
def test_live_gifts(self, param):
print(111111111111111111111)
r = live_request().live_gifts(param["channel_id"], param["gift_type"], param["stream_id"], param["offset"], param["size"])
if r["error"] == 0:
assert r["data"]["offset"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestLiveServices:
data = BaseRequest().api_load(path_setting.LIVESERVICES)
liveservices_case, liveservices_data = get_ids(data, "live_services")
@pytest.mark.parametrize("param", liveservices_data, ids=liveservices_case)
def test_live_services(self, param):
print(111111111111111111111)
r = live_request().live_services(param["channel_id"], param["stream_id"], param["offset"], param["size"])
if r["error"] == 0:
assert r["data"]["offset"] == param["assert"]
\ No newline at end of file
import pytest
import path_setting
from all_backend_api.janus_live_request import live_request
from ids_list import get_ids
from in_common.base_request import BaseRequest
class TestSearchService:
data = BaseRequest().api_load(path_setting.SEARCHSERVICE)
searchservice_case, searchservice_data = get_ids(data, "search_service")
@pytest.mark.parametrize("param", searchservice_data, ids=searchservice_case)
def test_search_service(self, param):
print(111111111111111111111)
r = live_request().search_service(param["current_city_id"], param["channel_id"], param["query"], param["offset"], param["size"], param["version"])
if r["error"] == 0:
assert r["data"]["services"] != param["assert"]
\ No newline at end of file
add_live_service:
#主播-推荐袋添加商品-添加一个商品
-
case: "主播-推荐袋添加商品-添加一个商品"
channel_id: "745"
service_item_ids: "560641"
version: "7.45.0"
assert : 成功添加1件商品
#主播-推荐袋添加商品-添加多个商品
-
case: "主播-推荐袋添加商品-添加多个商品"
channel_id: "745"
service_item_ids: "108278,578088,585823"
version: "7.45.0"
assert : 成功添加3件商品
\ No newline at end of file
delete_live_gift:
#主播-推荐袋删除美券-美券成功删除
-
case: "主播-推荐袋删除美券-美券成功删除"
channel_id: "745"
gift_id: "59088"
gift_type: "1"
stream_id: "4207"
version: "7.45.0"
assert : 美券已删除
\ No newline at end of file
delete_live_service:
#主播-推荐袋删除商品-商品成功删除
-
case: "主播-推荐袋删除商品-商品成功删除"
channel_id: "745"
live_service_id: "7251"
version: "7.45.0"
assert : 商品已删除
\ No newline at end of file
live_gifts:
#主播-推荐袋美券列表正常展示
-
case: "主播-推荐袋美券列表正常展示"
channel_id: "745"
gift_type: "3"
stream_id: "4205"
offset: "0"
size: "20"
assert : 0
live_services:
#主播-推荐袋美购列表正常展示
-
case: "主播-推荐袋美购列表正常展示"
channel_id: "745"
stream_id: "4181"
offset: "0"
size: "20"
assert : 0
search_service:
#主播-推荐袋商品搜索功能
-
case: "主播-推荐袋商品搜索功能"
current_city_id: "beijing"
channel_id: "745"
query: ""
offset: "0"
size: "20"
version: "7.45.0"
assert : 0
#主播-推荐袋商品搜索功能-捜索双眼皮
-
case: "主播-推荐袋商品搜索功能-捜索双眼皮"
current_city_id: "beijing"
channel_id: "745"
query: "双眼皮"
offset: "0"
size: "20"
version: "7.45.0"
assert : 0
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