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 TestServiceList:
    data = BaseRequest().api_load(path_setting.SERVICE_DATA)
    ServiceList_case, ServiceList_data = get_ids(data, "service_list")

    @pytest.mark.parametrize("params",ServiceList_data,ids=ServiceList_case)
    def test_ServiceList(self,params):

        r = web2_request().service_list(params['page'],params['pagesize'],params['is_online'])
        if r["error"] == 0:
            assert r["data"]["page"] == params["assert"]
        elif r["error"] == 1:
            assert r["message"] == params["assert"]
       # else:
          #  assert r['error'] == 0