import pytest

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


class TestProductMallServiceHomeFeed:
    data = BaseRequest().api_load(path_setting.FEED_TAB_SERVICE)
    productmallservicehomefeed_case, productmallservicehomefeed_data = get_ids(data, "feed_service")

    @pytest.mark.parametrize("param", productmallservicehomefeed_data, ids=productmallservicehomefeed_case)
    def test_product_mall_service_home_feed(self,param):
        r = janus_request().feed_service(param["tab_value"], param["first_load"])
        assert r["error"] == 0
        if r["error"] == 0:
            features = r.get("data").get("result",[])
            print(len(features))
            assert len(features) > param["assert"]


