*** Settings *** Library DatabaseLibrary Library RequestsLibrary Library Collections Library urllib3 *** Variables *** &{cloud_factory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 ${uecclient} https://api-client-uec-test.qniao.cn ${yytclient} https://api-client-yyt-test.qniao.cn ${yytops} https://api-ops-yyt-test.qniao.cn *** Test Cases *** customer_phone_captcha Disable Warnings Create Session uecclient ${uecclient} headers=${cloud_factory_customer_header} ${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号 ${customer_account} Set Variable 13012345678 ${body} Set Variable {"accountType":${accounttype},"account":"${customer_account}","captcha":"888888"} Set Global Variable ${customer_account} ${response} POST On Session uecclient /uec/authorize/by-captcha ${body} Log ${response.status_code} Log ${response.text} Log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} ${gettoken_customer} Get From Dictionary ${response.json()["data"]} token log ${gettoken_customer} Set Suite Variable ${gettoken_customer} ${userid_customer} Get From Dictionary ${response.json()["data"]} userId log ${userid_customer} #未转业务线token Set Suite Variable ${userid_customer} &{cloudfactorycustomerheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer} Set Suite Variable ${cloudfactorycustomerheader} customerclue_customer Disable Warnings Create Session yytclient ${yytclient} headers=${cloudfactorycustomerheader} ${customer_companyname} Set Variable autotest_companyname_customer ${customer_enterprisetype} Set Variable 2 #企业类型 1云印客户 2印刷包装厂 3造纸厂 4打包厂 5原纸供应商 6设备供应商 7其他 ${customer_job} Set Variable autotest_job_customer ${customer_name} Set Variable autotest_name_customer ${body} Set Variable {"companyName": "${customer_companyname}","enterpriseType": ${customer_enterprisetype},"job": "${customer_job}","name": "${customer_name}"} Set Suite Variable ${customer_companyname} Set Suite Variable ${customer_enterprisetype} Set Global Variable ${customer_job} Set Global Variable ${customer_name} ${response} POST On Session yytclient /cloud-print-user-center/save/customerclue ${body.encode("utf8")} Log ${response.status_code} Log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} sleep 1 customer_login_token Disable Warnings Create Session yytclient ${yytclient} headers=${cloudfactorycustomerheader} ${body} Set Variable {"loginToken":"${gettoken_customer}"} ${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")} Log ${response.status_code} Log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} ${getlogintoken_customer} Get From Dictionary ${response.json()} data log ${getlogintoken_customer} #全局token Set Global Variable ${getlogintoken_customer} &{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer} Set Suite Variable ${cloudfactory_customer_header} get_customerclue_customer Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header} ${response} Get On Session yytclient /cloud-print-user-center/get/my/customerclue Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Strings ${customer_companyname} ${response.json()["data"]["companyName"]} Should Be Equal As Numbers ${customer_enterprisetype} ${response.json()["data"]["enterpriseType"]} Should Be Equal As Strings ${customer_job} ${response.json()["data"]["job"]} Should Be Equal As Strings ${customer_name} ${response.json()["data"]["name"]} Should Be Equal As Strings ${customer_account} ${response.json()["data"]["mobile"]} customerclue_verify_have_join_customer Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header} ${response} POST On Session yytclient /cloud-print-user-center/verify/have-join-and-fill Log ${response.status_code} log ${response.json()} Should Be Equal As Strings False ${response.json()["data"]} #是否加入企业 False未加入 True已加入 customerclue_uploadpictures_customer Disable Warnings Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header} ${customer_businesslicense} Set Variable https://qncloudprintfiletest.oss-cn-shenzhen.aliyuncs.com/cloudprint/1632378545847.jpg ${customer_idcardback} Set Variable https://qncloudprintfiletest.oss-cn-shenzhen.aliyuncs.com/cloudprint/1632378545847.jpg ${customer_idcardfront} Set Variable https://qncloudprintfiletest.oss-cn-shenzhen.aliyuncs.com/cloudprint/1632378545847.jpg ${customerclue_type} Set Variable 1 #线索类型 1企业认证 2授信申请 ${body} Set Variable {"businessLicense": "${customer_businesslicense}","idCardBack": "${customer_idcardback}","idCardFront": "${customer_idcardfront}","type": ${customerclue_type}} ${response} POST On Session yytclient /cloud-print-user-center/customerclue/upload-pictures ${body.encode("utf8")} Log ${response.status_code} Log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} operate_get_user_register_list Create Session yytops ${yytops} headers=${operationbackend_header} ${response} Get On Session yytops /cloud-print-user-center/admin/user/get/user-list Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Strings ${account} ${response.json()["data"]["records"][0]["mobile"]} operate_get_user_register_search Create Session yytops ${yytops} headers=${operationbackend_header} ${param} Set Variable createTimeBegin=${current_date}&createTimeEnd=${current_date}&mobile=${account} ${response} Get On Session yytops /cloud-print-user-center/admin/user/get/user-list params=${param} Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Strings ${customer_account} ${response.json()["data"]["records"][0]["mobile"]} operate_get_customerclue_list Create Session yytops ${yytops} headers=${operationbackend_header} ${response} Get On Session yytops /cloud-print-user-center/admin/get/customerclue/page Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Strings ${customer_account} ${response.json()["data"]["records"][0]["mobile"]} Should Be Equal As Strings ${customer_companyname} ${response.json()["data"]["records"][0]["companyName"]} Should Be Equal As Numbers ${customer_enterprisetype} ${response.json()["data"]["records"][0]["enterpriseType"]} Should Be Equal As Strings ${customer_job} ${response.json()["data"]["records"][0]["job"]} Should Be Equal As Strings ${customer_name} ${response.json()["data"]["records"][0]["name"]} Should Be Equal As Strings ${userid_customer} ${response.json()["data"]["records"][0]["userId"]} operate_get_customerclue_search Create Session yytops ${yytops} headers=${operationbackend_header} ${param} Set Variable status=1 #客户线索状态 1待处理 2已处理 ${response} Get On Session yytops /cloud-print-user-center/admin/get/customerclue/page params=${param} Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Strings ${customer_account} ${response.json()["data"]["records"][0]["mobile"]} Should Be Equal As Strings ${customer_companyname} ${response.json()["data"]["records"][0]["companyName"]} Should Be Equal As Numbers ${customer_enterprisetype} ${response.json()["data"]["records"][0]["enterpriseType"]} Should Be Equal As Strings ${customer_job} ${response.json()["data"]["records"][0]["job"]} Should Be Equal As Strings ${customer_name} ${response.json()["data"]["records"][0]["name"]} Should Be Equal As Strings ${userid_customer} ${response.json()["data"]["records"][0]["userId"]} ${customerclue_id} Get From Dictionary ${response.json()["data"]["records"][0]} id Set Global Variable ${customerclue_id} operate_handle_customerclue Create Session yytops ${yytops} headers=${operationbackend_header} ${customerclue_remark} Set Variable autotest_customerclue_remark ${body} Set Variable {"id":"${customerclue_id}","adminId":"${operate_adminid}","name":"${operate_adminname}","remark":"${customerclue_remark}"} ${response} POST On Session yytops /cloud-print-user-center/admin/handle/customerclue ${body.encode("utf8")} Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} database_delete_user_customerclue Connect To Database Using Custom Params pymysql database='uec', user='root', password='password', host='8.135.8.221', port=3306, charset='utf8' Execute Sql String update qn_account set is_delete = 1 where tid = "${customer_account}" ${query} Query select user_id from qn_account where tid = "${customer_account}" ${query_list} Get From List ${query} 0 ${userid} Get From List ${query_list} 0 Execute Sql String update qn_user set is_delete = 1 where id = ${userid} sleep 1 Connect To Database Using Custom Params pymysql database='yyt_user_center', user='root', password='password', host='8.135.8.221', port=3306, charset='utf8' Execute Sql String update qn_customer_clue set is_delete = 1 where mobile = "${customer_account}" Disconnect From Database