import pytest

import path_setting
from all_doctor_api.web2_request import web2_request
from ids_list import get_ids
from in_common.base_request import BaseRequest


class TestServiceReviewList:

    service_review_list = BaseRequest().api_load(path_setting.SERVICE_REVIEW_DATA)
    ServiceReviewList_case, ServiceReviewList_data = get_ids(service_review_list, "service_review_list")

    @pytest.mark.parametrize("params", ServiceReviewList_data, ids=ServiceReviewList_case)
    def test_ServiceReviewList(self, params):
        r = web2_request().service_review_list(params['page'], params['pagesize'], params['type'])

        if r["error"] == 0:
            assert r["data"]["page"] == params["assert"]
        elif r["error"] == 1:
            assert r["message"] == params["assert"]