Commit 61849628 authored by 林颖's avatar 林颖

test

parent 42c6066e
from backend_auto import path_setting
from backend_auto.in_common.base_request import BaseRequest
class diary_data_reqest(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.DIARY_DATA_CONFIG)
def diary_data(self, current_city_id, diary_referrer, sort, count , start_num):
self.params["current_city_id"] = current_city_id
self.params["diary_referrer"] = diary_referrer
self.params["sort"] = sort
self.params["count"] = count
self.params["start_num"] = start_num
return self.api_send(self.data["diary_data"])
# if __name__ == '__main__':
# print(send_reqest().login_vfc("beijing", "+8612345678912", 1234, "", ""))
# print(send_reqest().diary_data("beijing", "my_diary", 0, 8, 2))
# print(1)
\ No newline at end of file
diary_data:
method: get
url: /api/diary/topic/15261339/_data
params:
current_city_id: ${current_city_id}
diary_referrer: ${diary_referrer}
sort: ${sort}
count: ${count}
start_num: ${start_num}
data:
json: {}
......@@ -6,6 +6,9 @@ sys.path.append(BASE_DIR)
HOSTYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto", "host.yaml")
APYAML_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "account_request.yaml")
LOGIN_VFC = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "login_vfc.yaml")
DIARY_DATA_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "diary_data_request.yaml")
DIARY_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/account_data", "diary_data.yaml")
if __name__ == '__main__':
print("==========",HOSTYAML_CONFIG)
from test_backend_case.account_case import test_login_vfc
from test_backend_case.account_case import test_diary_data
import pytest
......
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.diary_data_request import diary_data_reqest
class TestDIARYDATA:
data = BaseRequest().api_load(path_setting.DIARY_DATA)
diary_data_case, diary_data_data = get_ids(data, "diary_data")
@pytest.mark.parametrize("param",diary_data_data,ids=diary_data_case)
def test_diary_data(self,param):
print(2)
r = diary_data_reqest().diary_data(param["current_city_id"], param["diary_referrer"], param["sort"], param["count"], param["start_num"])
print(1)
if r["error"] == 0:
assert r["error"] == param["assert"]
# assert(r[""])
if r["error"] == 1:
assert r["error"] == param["assert"]
diary_data:
#字段正常case
-
case: "接口正常case"
current_city_id: "beijing"
diary_referrer: "my_diary"
sort: 0
count: 8
start_num: 2
assert: 0
-
case: "接口失败case"
current_city_id: "beijing"
diary_referrer: "my_diary"
sort: 0
count: 8
start_num: 2
assert: 1
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