An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
-
xiao-hesheng authored
产品信息审核_获取必要信息 产品信息审核_通过
6d3731d3
# -*- encoding=utf8 -*-
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web企业审核,id2248,sit,on,2023090802
主数据平台:产品新增和审核通过
"""
from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
def Enterprise_audit():
module = "mdm3-ea"
# 注册企业
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "CompanyRegist_url")
# #获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers",
commonFuc().get_business_data(module, "json_contentType"))
print(headers)
name = commonFuc().get_business_data(module, "name1") # 获取前缀name
cname = name + commonFuc().randomString(5) # 随机数生成拼接企业名称
request_body = commonFuc().get_business_data(module, "payload", cname, cname, cname, cname, cname, cname)
print(request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回id
id1 = commonFuc().analysis_json('id', result)
# 企业注册提交接口_认领
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url")
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId = login_system(username, password).get_token()
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode, token)
request_body = commonFuc().get_business_data(module, "payload1", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# # print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# =============== 企业注册提交接口_认领结束
# 企业审核接口_查询数据_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryListPage_url")
request_body = commonFuc().get_business_data(module, "payload2", cname)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(code, result)
# 断言实际结果中是否包含预期的文本
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_查询数据_结束
# 企业注册提交接口_锁定_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryAlCompanyRegistInfo_url")
request_body = commonFuc().get_business_data(module, "payload3", id1)
# 发送请求
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_锁定_结束
# 企业审核接口_再次查询数据_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "upCompanyList_url")
request_body = commonFuc().get_business_data(module, "payload4", cname)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_查询数据_结束
# 企业注册提交接口_审核通过_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditCompanyRegistBill_url")
request_body = commonFuc().get_business_data(module, "payload5", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',result)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
check_dict1 = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result)
return cname
# ===============企业注册提交接口_审核通过_结束
module = "mdm3-pim"
# 登录
username = Enterprise_audit()
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId = login_system(username, password).get_token()
# 分页查询供应商产品数据接口
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload", corpId)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('实际值',result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
data = commonFuc().analysis_json('data', data)
# print('aaaaaaaaaaaaaaaaaaaaaaaaaaaa',data)
# 断言实际结果中是否包含预期结果的内容
# 新注册的企业首次查询产品信息,预期结果为空
check_dict = commonFuc().get_business_data(module, "checkDict")
# print('预期值',check_dict)
commonFuc().check_text_exist(code, result) # 检查验证码
commonFuc().check_text_exist(data, result) # 检查数据data为空[]
# 产品申报
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitGoodsRegist_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
p_name = commonFuc().get_business_data(module, "name1") # 获取前缀name
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
p_name = p_name + commonFuc().randomString(5) # 随机数生成拼接产品名称
request_body = commonFuc().get_business_data(module, "payload6", p_name, p_name, p_name, p_name, p_name, p_name, p_name,
p_name, p_name, p_name, p_name, p_name, p_name, p_name)
print('新增产品请求体', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print("新增产品返回结果", result)
goodsRegistVO = commonFuc().analysis_json('goodsRegistVO', result)
goodsName = commonFuc().analysis_json('goodsName', goodsRegistVO)
commonFuc().check_text_exist(goodsName, result) # 检查返回结果中是否存在新增的产品名称
# ===================产品查询==========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listAuditBillByPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload7", p_name)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('查询产品信息',result)
data = commonFuc().analysis_json('data', result)
GRBid = commonFuc().analysis_json('id', data)
print('GRBid',GRBid)
# ===================产品查询后锁定==================================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url2")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
now = timeUtils().get_time_hms()
request_body = commonFuc().get_business_data(module, "payload8", GRBid, uxid, now)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('锁定结果',result)
# ===================产品锁定后查询获取产品详情登等必要信息==========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getGoodsRegistBillDetail_url")
url = url + GRBid + "/1"
print('url', url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
# 发送请求
result = commonFuc().http_get(url, headers)
print('产品锁定后查询获取必要信息', result)
# print('data',data)
goodsRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data', result)))
print('goodsRegistVO_id', goodsRegistVO_id)
goodsName = p_name
goodsMfrsId = commonFuc().analysis_json('goodsMfrsId', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data',
result)))
corpId = commonFuc().analysis_json('corpId', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data', result)))
registrationRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('registrationRegistVO',
commonFuc().analysis_json('data',
result)))
goodsSpecsRegistVOList_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsSpecsRegistVOList',
commonFuc().analysis_json('data',
result)))
print(goodsRegistVO_id, goodsMfrsId, corpId, registrationRegistVO_id, goodsSpecsRegistVOList_id)
# =============================产品审核通过======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "handleAuditGoodsRegist_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
211212213214215216217218219220221222223
projectCode)
request_body = commonFuc().get_business_data(module, "payload9", GRBid, goodsRegistVO_id, now, now, uxid, uxid, GRBid,
goodsName, goodsMfrsId, goodsMfrsId, corpId, corpId,
goodsSpecsRegistVOList_id, now, now, uxid, uxid, GRBid, goodsRegistVO_id,
goodsMfrsId, goodsName, goodsName, goodsName, goodsName, goodsName,
goodsName, registrationRegistVO_id, now, now, uxid, uxid, GRBid,
goodsRegistVO_id, goodsName, now, goodsMfrsId, goodsMfrsId, goodsName)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('产品审核通过',result)
code= commonFuc().analysis_json('code', result)
commonFuc().check_text_exist_result_text(code,result)