Example #1
0
 def test_passes_errors_when_creating_invoice(self):
   """web errors should be gracefully passed to the client"""
   new_client = Client()
   def a_request(url, request):
     return {'status_code': 403, 'content': b'{"error": "this is a 403 error"}'}
   with HTTMock(a_request):
     with self.assertRaisesRegexp(BitPayBitPayError, "403: this is a 403 error"):
       new_client.create_invoice({"price": 20, "currency": "USD"})
Example #2
0
    def test_passes_errors_when_creating_invoice(self):
        """web errors should be gracefully passed to the client"""
        new_client = Client()

        def a_request(url, request):
            return {
                'status_code': 403,
                'content': b'{"error": "this is a 403 error"}'
            }

        with HTTMock(a_request):
            with self.assertRaisesRegexp(BitPayBitPayError,
                                         "403: this is a 403 error"):
                new_client.create_invoice({"price": 20, "currency": "USD"})