Commit 0e0c0159 authored by 张慧's avatar 张慧

城市筛选器接口case完善

parent 9f9a6ddd
......@@ -8,7 +8,6 @@ class filter_request(BaseRequest):
self.data = self.api_load(path_setting.FILTER_CONFIG)
def service_home_city_v2(self, current_city_id, lat, lng):
print("fgx")
self.params["current_city_id"] = current_city_id
self.params["lat"] = lat
self.params["lng"] = lng
......@@ -16,8 +15,7 @@ class filter_request(BaseRequest):
if __name__ == '__main__':
#城市筛选器
# 城市筛选器
print(filter_request().service_home_city_v2("", "40.002", "116.487252"))
print("fgx")
......@@ -8,12 +8,15 @@ from all_backend_api.filter_request import filter_request
class TestServiceHomeCityV2:
data = BaseRequest().api_load(path_setting.FILTER)
servicehomecityv2_case, servicehomecityv2_data = get_ids(data, "service_home_city_v2")
service_home_city_v2_case, service_home_city_v2_data = get_ids(data, "service_home_city_v2")
@pytest.mark.parametrize("param", servicehomecityv2_data, ids=servicehomecityv2_case)
@pytest.mark.parametrize("param", service_home_city_v2_data, ids=service_home_city_v2_case)
def test_service_home_city_v2(self, param):
r = filter_request().service_home_city_v2(param["current_city_id"], param["lat"], param["lng"])
# print('feng=', r)
if r["error"] == 0:
assert len(r["data"]["area"]) > 0
if param["current_city_id"] == "worldwide":
assert r["error"] == param["assert_worldwide"]
if param["lat"] == "39.98316321398558" and param["lng"] == "116.4881236681604":
assert r["data"]["recommend"]["located"][0]["id"] == param["assert_beijing"]
if param["lat"] == "45.742347" and param["lng"] == "126.661669":
assert r["data"]["recommend"]["located"][0]["id"] == param["assert_haerbin"]
#城市筛选器
service_home_city_v2:
-
case: "城市筛选器接口"
case: "城市筛选器接口-current_city_id为空case-经纬度北京"
current_city_id: ""
lat: "39.98316321398558"
lng: "116.4881236681604"
assert_beijing: "beijing"
-
case: "城市筛选器接口-current_city_id为空case-经纬度哈尔滨"
current_city_id: ""
lat: "45.742347"
lng: "126.661669"
assert_haerbin: "haerbin"
-
case: "城市筛选器接口-全部城市case"
current_city_id: "worldwide"
lat: "40.002"
lng: "116.487252"
assert: 0
assert_worldwide: 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