You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

150 lines
8.4 KiB

*** Settings ***
Library urllib3
Library String
Library demjson
Library Collections
Library JSONLibrary
Library RequestsLibrary
Library OperatingSystem
*** Keywords ***
用户首次填写${dating}资料
Disable Warnings
#获取首次婚介资料信息
Create Session dating ${${dating}.UEC域名} ${${dating}.Header}
${reps} GET On Session dating /dating-agency-service/user/get/first/fill/marriage/information/details params=userId=808374438260248576
${Data} Get From Dictionary ${reps.json()} data
log ${Data}
${id} Get From Dictionary ${reps.json()['data']} id #资料id
${height} Get From Dictionary ${reps.json()['data']} height #证婚人身高
${nickName} Get From Dictionary ${reps.json()['data']} nickName #证婚人昵称
${cityCode} Get From Dictionary ${reps.json()['data']} cityCode #市编号
${cityName} Get From Dictionary ${reps.json()['data']} cityName #市名称
${birthYear} Get From Dictionary ${reps.json()['data']} birthYear #证婚人出生年份
${genderCode} Get From Dictionary ${reps.json()['data']} genderCode #证婚人性别
${incomeCode} Get From Dictionary ${reps.json()['data']} incomeCode #证婚人月收入
${districtCode} Get From Dictionary ${reps.json()['data']} districtCode #区编码
${districtName} Get From Dictionary ${reps.json()['data']} districtName #区名称
${provinceCode} Get From Dictionary ${reps.json()['data']} provinceCode #省编码
${provinceName} Get From Dictionary ${reps.json()['data']} provinceName #省名称
${educationCode} Get From Dictionary ${reps.json()['data']} educationCode #证婚人学历编码
${fillSerialNumber} Get From Dictionary ${reps.json()['data']} fillSerialNumber #资料填写序号
${maritalStatusCode} Get From Dictionary ${reps.json()['data']} maritalStatusCode #证婚人婚姻状况,0:未婚,1:离异,2:丧偶的 0:未婚,1:离异,2:丧偶的
#${Information} Create Dictionary
Set Global Variable ${id}
Set Global Variable ${Data}
Set Global Variable ${height}
Set Global Variable ${nickName}
Set Global Variable ${cityCode}
Set Global Variable ${cityName}
Set Global Variable ${birthYear}
Set Global Variable ${genderCode}
Set Global Variable ${incomeCode}
Set Global Variable ${districtCode}
Set Global Variable ${districtName}
Set Global Variable ${provinceCode}
Set Global Variable ${provinceName}
Set Global Variable ${educationCode}
Set Global Variable ${fillSerialNumber}
Set Global Variable ${maritalStatusCode}
检查首次填写${dating}资料序号
#检查首次填写序号
Create Session dating ${${dating}.UEC域名} ${${dating}.Header}
${reps} GET On Session dating /dating-agency-service/user/check/first/fill/marriage/information/sn params=userId=808374438260248576
${fillSerialNumber} Get From Dictionary ${reps.json()['data']} fillSerialNumber #填写序号
Set Global Variable ${fillSerialNumber}
选择${dating}性别资料
#选择性别
Log To Console ${CURDIR}
Disable Warnings
#用户首次填写婚介资料
${SexCode} Evaluate 1 #男:0,女:1
${Number} Evaluate 0 #0:"性别",1:"所在城市",2:"出生年份",3:"身高",4:"学历",5:"婚姻状态",6:"月收入",7:"昵称",8:"首次填写完成"
Create Session dating ${${dating}.UEC域名} ${${dating}.Header}
${Data} Update Value To Json ${Data} $.genderCode ${SexCode}
${Data} Update Value To Json ${Data} $.fillSerialNumber ${Number}
${Data} Evaluate demjson.encode(${DATA}) demjson
${Data} Replace String ${Data} "None" null
log ${Data}
${reps} POST On Session dating /dating-agency-service/user/save/first/fill/marriage/Information ${Data.encode('utf-8')}
${DataId} Get From Dictionary ${reps.json()} data #获取证婚人资料id
Set Global Variable ${DataId}
#检查首次填写婚介资料序号
选择${dating}征婚人的城市
#选择城市
#获取省市区
Disable Warnings
Create Session region http://qncloud.oss-cn-shenzhen.aliyuncs.com
${reps} GET On Session region address.json
${local_data} Get From Dictionary ${reps.json()} data
FOR ${province} IN @{local_data} #省列表数据
${provinceCode} Get From Dictionary ${province} value #获取省编码
${provinceName} Get From Dictionary ${province} label #获取省名称
Exit For Loop If '${provinceName}'=='广东省'
END
${city_data} Get From Dictionary ${province} children #广东省市列表数据
FOR ${city} IN @{city_data}
${cityCode} Get From Dictionary ${city} value #获取市编码
${cityName} Get From Dictionary ${city} label #获取市名称
Exit For Loop If '${cityName}'=='广州市'
END
${district_data} Get From Dictionary ${city} children #广州市列表数据
log ${district_data}
${district} Evaluate random.choice(${district_data}) random
${districtCode} Get From Dictionary ${district} value #随机获取广州市区编码
${districtName} Get From Dictionary ${district} label #随机获取广州市区名称
Set Global Variable ${cityCode}
Set Global Variable ${cityName}
Set Global Variable ${districtCode}
Set Global Variable ${districtName}
Set Global Variable ${provinceCode}
Set Global Variable ${provinceName}
#选择征婚人地区资料
${Number} Evaluate 1 #0:"性别",1:"所在城市",2:"出生年份",3:"身高",4:"学历",5:"婚姻状态",6:"月收入",7:"昵称",8:"首次填写完成"
Create Session dating ${${dating}.UEC域名} ${${dating}.Header}
${Data} Update Value To Json ${Data} $.id ${DataId}
${Data} Update Value To Json ${Data} $.fillSerialNumber ${Number}
${Data} Update Value To Json ${Data} $.fillSerialNumber ${fillSerialNumber}
${Data} Update Value To Json ${Data} $.cityCode ${cityCode}
${Data} Update Value To Json ${Data} $.cityName ${cityName}
${Data} Update Value To Json ${Data} $.districtCode ${districtCode}
${Data} Update Value To Json ${Data} $.districtName ${districtName}
${Data} Update Value To Json ${Data} $.provinceCode ${provinceCode}
${Data} Update Value To Json ${Data} $.provinceName ${provinceName}
${Data} Evaluate demjson.encode(${DATA}) demjson
${Data} Replace String ${Data} "None" null
${reps} POST On Session dating /dating-agency-service/user/save/first/fill/marriage/Information ${Data.encode('utf-8')}
#检查首次填写婚介资料序号
用户首次填写婚介资料
出生年份
身高
学历
婚姻状况
月收入
昵称
返回上一步
测试${dating}资料填写
#选择性别
Create Session dating ${${dating}.UEC域名} ${${dating}.Header}
${sex_data} Evaluate 1
${data} Set Variable {"id":null,"fillSerialNumber":0,"genderCode":1}
${reps} POST On Session dating dating-agency-service/user/save/first/fill/marriage/Information ${data.encode('utf-8')}
${id} Get From Dictionary ${reps.json()} data
#选择城市
${city_data} Set Variable { \ \ \ \ "id": "${id}", \ \ \ \ "fillSerialNumber": 1, \ \ \ \ "provinceCode": 440000, \ \ \ \ "provinceName": "广东省", \ \ \ \ "cityCode": 440100, \ \ \ \ "cityName": "广州市", \ \ \ \ "districtCode": 440106, \ \ \ \ "districtName": "天河区" }
${reps} POST On Session dating dating-agency-service/user/save/first/fill/marriage/Information ${city_data.encode('utf-8')}
sleep 2
#获取首次婚介资料信息
${reps} GET On Session dating dating-agency-service/user/get/first/fill/marriage/information/details params=userId=808374438260248576
log ${reps.json()['data']}