def test_login2(self): '''正确的用户名和错误密码''' login = LOGIN() res = login.login("18752311511", "zy5685212") print(res) msg = res["head"]["msg"] self.assertEqual(msg, "您输入的手机号与密码不符!", "用例执行错误")
def test_login(self): '''正确的用户名和密码登录成功''' login = LOGIN() res = login.login("13770506773", "zy568521") name = res["body"]["name"] # totalAsset = res["body"]["totalAsset"] self.assertEqual(name, "赵耀测试数据", "用例执行错误")
def allot_trade(self, applyAmount, tradePwd): u'''申购宝宝类类基金000379,申购成功''' login = LOGIN() res = login.login("13770506773", "zy568521") token = res["body"]["token"] url = "http://djuat.dtfunds.com/fund-app/trade/payment" data = { "applyAmount": applyAmount, "sale_compare": "1", "acceptProtocol": "1", "fundCode": "000379", "buyType": "BB", "tradePwd": tradePwd, "token": token } res = requests.post(url, data).json() return res
def test_orderdetail(self): login = LOGIN() res_login = login.login("13770506773","zy568521") data ={ "token": res_login["body"]["token"], "type":"JJ", "pageIndex":"1", } url = "http://djuat.dtfunds.com/fund-app/trade/queryUserTransRecord" res = requests.post(url,data).json() # print(res) account = int(res["body"]["totalNumber"]) if account > 1: orderNo = res["body"]["items"][0]["orderNo"] url ="http://djuat.dtfunds.com/fund-app/order/getOrderDetail" data ={ "token": res_login["body"]["token"], "orderNo":orderNo } res= requests.post(url,data).json() self.assertEqual(res["head"]["msg"],"成功","测试失败,")
def setUpClass(cls): login = LOGIN() res = login.login("13770506773", "zy568521") cls.token = res["body"]["token"] print(cls.token) print("测试多个用例只执行一次")