import pytest

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


class TestDoctorRegister:

    data = BaseRequest().api_load(path_setting.DOCTOR_REGISTER)
    doctor_register_case, doctor_register_data = get_ids(data, "doctor_register")

    @pytest.mark.parametrize("param",doctor_register_data,ids=doctor_register_case)
    def test_doctor_register(self,param):
        r = web_request().doctor_register(param["doctorregister_id"])
        if r["error"] == 0:
            assert r["error"] == param["assert"]
            assert r["data"]['register_phone'] is not None and r["data"]['register_phone'] is not ""  # 校验注册手机号不为空
            assert r["data"]['department'] is not None and r["data"]['department'] is not ""  # 校验所在科室不为空
            assert r["data"]['good_at'] is not None and r["data"]['good_at'] is not ""  # 校验项目不为空
            assert r["data"]['name'] is not None and r["data"]['name'] is not ""  # 校验名字不为空
            assert r["data"]['professional_certificate_num'] is not None and r["data"]['professional_certificate_num'] is not ""  # 校验证书不为空

    # elif r["error"] == 1:
        #     assert r["message"] == params["assert"]