def teststeps(self): STEP(1, '获取当前最新一条批次信息') batchNo1 = enterpriseOpApi.pack_qrcode_batch_checkpoint(packIdSalt)['batchNo'] INFO(f'包装批次:{batchNo1}') STEP(2, '包装批量打码') batchNo2 = webOpEnterprise.multi_print_pack_qrcode(packNameSalt) INFO(f'包装批次:{batchNo2}') CHECK_POINT('检查是否生成新的打码批次', batchNo1 != batchNo2) STEP(3, '获取当前最新一条批次成功数量') successNum = enterpriseOpApi.pack_qrcode_batch_checkpoint(packIdSalt)['successNum'] CHECK_POINT('检查成功数量', 1000 == int(successNum)) STEP(4, '查看下载的码文件') fileZipPath = get_recent_file(exp=f'{batchNo2}.zip') INFO(f'下载文件:{fileZipPath}') STEP(5, '服务端解码') webOpEnterprise.service_decode_pack_qrcode(fileZipPath,packNameSalt) STEP(6, '查看解码文件') fileDecPath = get_recent_file(exp=f'{batchNo2}_dec.zip') INFO(f'下载文件:{fileDecPath}') STEP(7, '解压码文件') filePathList = unzip_file(fileDecPath) fileUnzipPath = filePathList[0] INFO(f'解压后的文件:{fileUnzipPath}') STEP(8, '获取文件中的第一个溯码') qrcode = get_qrcode_by_file(0, fileUnzipPath) INFO(f'码值:{qrcode}') STEP(9, '通过码查询接口查询码内容') ret_dict = enterpriseOpApi.search_qrcode_short_info(qrcode) CHECK_POINT('检查码内容是否符合预期', ret_dict == desired_dict_pack)
def teststeps(self): STEP(1, '获取当前最新一条批次信息') batchNo1 = enterpriseOpApi.root_code_batch_checkpoint()['batchNo'] INFO(f'主体码批次:{batchNo1}') STEP(2, '主体码溯码打码') batchNo2 = webOpEnterprise.print_multi_root(mailAddressPlusName) INFO(f'主体码批次:{batchNo2}') CHECK_POINT('检查是否生成新的打码批次', batchNo1 != batchNo2) STEP(3, '获取当前最新一条批次成功数量') successNum = enterpriseOpApi.root_code_batch_checkpoint()['successNum'] CHECK_POINT('检查成功数量', 2 == int(successNum)) STEP(4,'查看解码密码') password = webOpEnterprise.send_records() STEP(5,'下载码包') filePath = retry_download_attachment() INFO(f'码包路径:{filePath}') STEP(6, '解压码包') filePathList = unzip_file(filePath,password) fileUnzipPath = filePathList[0] INFO(f'解压后的文件:{fileUnzipPath}') STEP(7, '获取文件中的第一个溯码') qrcode = get_qrcode_by_file(0, fileUnzipPath) INFO(f'码值:{qrcode}') STEP(8, '通过码查询接口查询码内容') ret_dict = enterpriseOpApi.search_qrcode_short_info(qrcode,onlyCodeRequired=True) onlyCode1 = ret_dict['onlyCode'] ret_dict.pop('onlyCode') CHECK_POINT('检查码内容是否符合预期', ret_dict == desired_dict_root) STEP(9, '获取文件中的第二个溯码') qrcode = get_qrcode_by_file(0, fileUnzipPath,2) INFO(f'码值:{qrcode}') STEP(10, '通过码查询接口查询码内容') ret_dict = enterpriseOpApi.search_qrcode_short_info(qrcode,onlyCodeRequired=True) onlyCode2 = ret_dict['onlyCode'] ret_dict.pop('onlyCode') CHECK_POINT('检查码是否唯一', onlyCode1 != onlyCode2)
def teststeps(self): STEP(1, '获取当前最新一条批次信息') batchNo1 = enterpriseOpApi.product_qrcode_batch_checkpoint(productIdSalt)['batchNo'] INFO(f'产品批次:{batchNo1}') STEP(2, '单个产品溯码打码') batchNo2 = webOpEnterprise.print_product_qrcode(productNameSalt) INFO(f'产品批次:{batchNo2}') CHECK_POINT('检查是否生成新的打码批次', batchNo1 != batchNo2) STEP(3, '获取当前最新一条批次成功数量') successNum = enterpriseOpApi.product_qrcode_batch_checkpoint(productIdSalt)['successNum'] CHECK_POINT('检查成功数量', 1 == int(successNum)) STEP(4, '查看下载的码文件') file_path = get_recent_file(exp='code.txt') INFO(f'下载文件:{file_path}') STEP(5, '获取文件中的第一个溯码') qrcode = get_qrcode_by_file(0, file_path) INFO(f'码值:{qrcode}') STEP(6, '通过码查询接口查询码内容') ret_dict = enterpriseOpApi.search_qrcode_short_info(qrcode) CHECK_POINT('检查码内容是否符合预期', ret_dict == desired_dict_product)