예제 #1
0
 def test_02(self):
     '''测试支付失败场景'''
     # mock一个支付失败的数据
     temple.zhifu = mock.Mock(return_value={"result": "fail", "reason": "余额不足"})
     # 根据支付结果测试页面跳转
     statues = temple.zhifu_statues()
     self.assertEqual(statues, "支付失败")
예제 #2
0
    def test_02(self, mock_zhifu):
        '''测试支付失败场景'''
        # mock一个支付成功的数据

        mock_zhifu.return_value = {"result": "fail", "reason": "余额不足"}
        # 根据支付结果测试页面跳转
        statues = temple.zhifu_statues()
        self.assertEqual(statues, "支付失败")
예제 #3
0
 def test_01(self):
     # 测试支付成功场景
     # mock一个支付成功的场景
     temple.zhifu = mock.Mock(return_value={'result': 'success', 'reson': 'null'})
     # 根据结果页面跳转
     status = temple.zhifu_statues()
     print status
     self.assertEquals(status, '支付成功')
예제 #4
0
    def test_01(self):
        '''测试支付成功场景'''
        # mock 一个支付成功的数据
        temple.zhifu = mock.Mock(return_value={"result":"success","reason":"null"})

        # 根据支付结果测试页面跳转
        statues = temple.zhifu_statues()
        print(statues)
        self.assertEqual(statues,"支付成功")
예제 #5
0
    def test_01(self, mock_zhifu):
        # 方法一:mock一个支付成功的数据
        # temple.zhifu = mock.Mock(return_value={"result": "success", "reason":"null"})

        # 方法二:mock.path装饰器模拟返回结果
        mock_zhifu.return_value = {"result": "success", "reason": "null"}
        # 根据支付结果测试页面跳转
        statues = temple.zhifu_statues()
        print(statues)
        self.assertEqual(statues, "支付成功")
예제 #6
0
 def test_04(self):
     temple.zhifu = mock.Mock(return_value={'resultoo': 'wait', 'reason': 'null'})
     status = temple.zhifu_statues()
     self.assertEquals(status, 'Error, 服务端返回异常!')
예제 #7
0
 def test_03(self):
     temple.zhifu = mock.Mock(return_value={'result': 'wait', 'reason': 'null'})
     status = temple.zhifu_statues()
     self.assertEquals(status, '未知错误异常')