import pytest

import path_setting
from all_backend_api.search_request import search_request
from ids_list import get_ids
from in_common.base_request import BaseRequest

#搜索首页-热门搜索
class TestKeywords:
    data = BaseRequest().api_load(path_setting.KEYWORDS)
    keywords_case, keywords_data = get_ids(data, "keywords")

    @pytest.mark.parametrize("param", keywords_data, ids=keywords_case)
    def test_keywords(self, param):
        r = search_request().keywords(param["current_city_id"], param["search_tab"])
        if r["error"] == 0:
            assert r["error"] == param["assert"]

        print("接口调用成功了~")
