Пример #1
0
    def test_client_cc_update_fails_returns_error(self):
        self.client.credit_card_response = FakeUbersmithError(999, 'oh fail')

        with self.app.test_client() as c:
            resp = c.post('api/2.0/',
                          data={
                              "method": "client.cc_update",
                              "client_id": "1"
                          })

        self.assertEqual(resp.status_code, 200)
        self.assertEqual(
            json.loads(resp.data.decode('utf-8')), {
                "data": "",
                "error_code": 999,
                "error_message": "oh fail",
                "status": False
            })
Пример #2
0
    def test_service_plan_get_errs_with_service_plan_error(self):
        self.uber.service_plan_error = FakeUbersmithError(999, 'some error')

        with self.app.test_client() as c:
            resp = c.post('api/2.0/',
                          data={
                              "method": "uber.service_plan_get",
                              "plan_id": "100"
                          })

        self.assertEqual(resp.status_code, 200)
        self.assertEqual(
            json.loads(resp.data.decode('utf-8')), {
                "data": "",
                "error_code": 999,
                "error_message": "some error",
                "status": False
            })
Пример #3
0
    def test_cancel_order_errs(self):
        self.data_store.order_cancel = {
            "100": FakeUbersmithError(code=999, message='epic fail')
        }

        with self.app.test_client() as c:
            resp = c.post('api/2.0/',
                          data={
                              "method": "order.cancel",
                              "order_id": "100"
                          })

        self.assertEqual(resp.status_code, 200)
        self.assertEqual(
            json.loads(resp.data.decode('utf-8')), {
                "data": "",
                "error_code": 999,
                "error_message": "epic fail",
                "status": False
            })