def register(self): '''注册''' url = "http://test.lemonban.com/futureloan/mvc/api/member/register" phone = ob.getstr('register', 'phone') pwd = ob.getstr('register', 'pwd') data = {"mobilephone": phone, "pwd": pwd, "regname": "zhaojian"} HttpSession(url=url, data=data).httprequest(method='post') # 发送请求 setattr(ConText, "phone", phone) # 将注册之后的手机号码临时变量当中 setattr(ConText, "pwd", pwd) # 将注册之后的密码临时变量当中 memerid = self.mysql.select( 'SELECT id FROM member WHERE MobilePhone="{}"'.format(phone))[0][0] setattr(ConText, "memberId", memerid) # 将注册之后的用户id写到临时变量当中 update_phone() # 更新配置文件的手机号码
def sendMCode(self): mysql = ObMysql(database="sms_db_45") url = "http://120.24.235.105:9010/sms-service-war-1.0/ws/smsFacade.ws?wsdl" client = Client(url=url) # 建立连接 client_ip = ob.getstr('register', 'client_ip') phone = ob.getstr('register', 'phone') username = ob.getstr('register', 'username') pwd = ob.getstr('register', 'pwd') data = {"client_ip": client_ip, "tmpl_id": 1, "mobile": phone} client.service.sendMCode(data) # 请求 verify_code = mysql.select( "SELECT Fverify_code FROM t_mvcode_info_6 WHERE Fmobile_no= '{}'". format(phone))[0][0] # 获取短信验证码 setattr(ConText, 'client_ip', client_ip) # 将ip地址添加到临时变量 setattr(ConText, 'phone', phone) # 将手机号添加到临时变量 setattr(ConText, 'username', username) # 将用户名添加到临时变量 setattr(ConText, 'pwd', pwd) # 密码添加到临时变量 setattr(ConText, 'verify_code', verify_code) # 将短信验证码添加到临时变量 mysql.close() update_phone() # 更新配置文件
def tearDown(self): print('{}测试用例执行完毕'.format(self)) update_phone() # 更新手机号码和登录密码