def test_factory_base_no_type(): """视光厂商——基本信息保存(单位性质不传)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_.pop('mfr_type') # 基本信息保存 save_factory_base_info(data_, exp_status='0001', exp_message=u'单位性质不能为空')
def test_factory_base_no_name(): """视光厂商——基本信息保存(名称不输入)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = '' data_['mfr_type'] = 3 # 基本信息保存 save_factory_base_info(data_, exp_status='0001', exp_message=u'名称不能为空')
def test_factory_base_invalid_type(mfr_type): """视光厂商——基本信息保存(非法单位性质)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = mfr_type # 基本信息保存 save_factory_base_info(data_, exp_http_status=500, exp_status='0001', exp_message=u'未知的厂商类型')
def test_factory_base_update(): """视光厂商——基本信息修改""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 3 # 上传工商营业执照 file_id_biz = upload_picture(12, 'jpeg', 'picture/beauty.jpeg') data_['mfr_biz_licence_photo'] = file_id_biz # 医疗器械经营许可证 file_id_run = upload_picture(7, 'jpg', 'picture/anti-mage.jpg') data_['mfr_licence_photo'] = file_id_run # 医疗器械生产许可证证照片 file_id_prod = upload_picture(8, 'png', 'picture/dog.png') data_['mfr_produ_photo'] = file_id_prod # 基本信息保存 resp_save = save_factory_base_info(data_) # 修改基本信息 data_update = copy.deepcopy(data_) data_update['mfr_id'] = resp_save['data']['mfr_id'] data_update['mfr_compaddress'] = u"物联网街451号" update_factory_base_info(data_update) # 校验 verify_result(data_update, resp_save['data'])
def test_factory_list(): # 视光厂商列表 # 新增供应商; enable状态为1 data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 1 data_['mfr_enable'] = 1 # 基本信息保存 resp_save = save_factory_base_info(data_) # 查询厂商列表 key=mfr_code,状态全部,性质全部 params = copy.deepcopy(PARAMS_FACTORY_LIST) params['key'] = data_['mfr_code'] resp_get = get_factory_list(params) # 校验 期望能查询到数据 verify_result(resp_get['data'], 1, resp_save['data']['mfr_id'], data_) # 查询厂商列表 key=mfr_code,状态停用,性质全部 params = copy.deepcopy(PARAMS_FACTORY_LIST) params['key'] = data_['mfr_code'] params['mfr_enable'] = 0 resp_get = get_factory_list(params) # 校验 期望不能查询到数据 verify_result(resp_get['data'], 0, resp_save['data']['mfr_id'], None) # 查询厂商列表 key=mfr_code,状态全部,性质生产商 params = copy.deepcopy(PARAMS_FACTORY_LIST) params['key'] = data_['mfr_code'] params['mfr_type'] = 2 resp_get = get_factory_list(params) # 校验 期望不能查询到数据 verify_result(resp_get['data'], 0, resp_save['data']['mfr_id'], None)
def test_factory_base_traveral_type(mfr_type): """视光厂商——基本信息保存(遍历单位性质)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = mfr_type # 基本信息保存 resp_save = save_factory_base_info(data_) # 校验 verify_result(data_, resp_save['data'])
def test_factory_base_invalid_enable(): """视光厂商——基本信息保存(非法enable)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 3 data_['mfr_enable'] = 2 # 基本信息保存 resp_save = save_factory_base_info(data_) # 校验 verify_result(data_, resp_save['data'])
def test_factory_base_update_traveral_type(mfr_type): """视光厂商——基本信息修改(遍历类型)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 3 # 基本信息保存 resp_save = save_factory_base_info(data_) # 修改基本信息 data_update = copy.deepcopy(data_) data_update['mfr_id'] = resp_save['data']['mfr_id'] data_update['mfr_type'] = mfr_type update_factory_base_info(data_update) # 校验 verify_result(data_update, resp_save['data'])
def test_factory_base_update_no_type(): """视光厂商——基本信息修改(单位性质不传)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 3 # 基本信息保存 resp_save = save_factory_base_info(data_) # 修改基本信息 data_update = copy.deepcopy(data_) data_update['mfr_id'] = resp_save['data']['mfr_id'] data_update.pop('mfr_type') update_factory_base_info(data_update, exp_http_status=500, exp_status='0001', exp_message=u'单位性质不能为空')
def test_factory_base_both(): """视光厂商——基本信息保存(供应商&生产厂商)""" # 新增供应商(正常情况) data_ = copy.deepcopy(MFR_DATA) data_['mfr_code'] = unique_id(13) data_['mfr_name'] = unique_id(13) data_['mfr_type'] = 3 # 上传工商营业执照 file_id_biz = upload_picture(12, 'jpeg', 'picture/beauty.jpeg') data_['mfr_biz_licence_photo'] = file_id_biz # 医疗器械经营许可证 file_id_run = upload_picture(7, 'jpg', 'picture/anti-mage.jpg') data_['mfr_licence_photo'] = file_id_run # 医疗器械生产许可证证照片 file_id_prod = upload_picture(8, 'png', 'picture/dog.png') data_['mfr_produ_photo'] = file_id_prod # 基本信息保存 resp_save = save_factory_base_info(data_) # 校验 verify_result(data_, resp_save['data'])