def test_B_UserLogin_Each_other(self): "2.工程商登录" self.casename = 'user_type=100' casename = self.casename log.debug(casename + u':开始执行') try: parameter = {'r': 'v1.4/user/login', 'phone': '17748484849', 'passcode': '1234', 'user_type': '100'} self.response, self.cookie = Api_urllib.getCookie(parameter) # 保持cookie Api_urllib.save_cookie_as_file(self.cookie, who='100') self.result = "Pass" except Exception as msg: log.error("Excepthon Logged") print (msg) raise finally: test_result.set_test_result(self.response, self.cookie, self.interfacename, self.casename, self.comment, self.result)
def test_A_UserLogin(self): '''1.用户登录''' self.casename = 'user_type=1' casename = self.casename log.debug(casename + u':开始执行') try: parameter = {'r': 'v1.4/user/login', 'phone': '17748484840', 'passcode': '1234', 'user_type': '1'} self.response, self.cookie = Api_urllib.getCookie(parameter) if self.response['succ'] == '1': self.assertTrue(self.response.has_key('is_new')) else: self.assertTrue(self.response.has_key('msg')) Api_urllib.save_cookie_as_file(self.cookie, who='1') self.result = "Pass" log.debug(u'工程商登录,保存cookie') except Exception as msg: log.error("Excepthon Logged") log.error(msg) print (msg) raise finally: test_result.set_test_result(self.response, self.cookie, self.interfacename, self.casename, self.comment, self.result) log.debug(casename + u':执行完毕')