async def test_response_headers(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     try:
         await aiostripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
         self.fail('charge creation with expired card did not fail')
     except aiostripe.error.CardError as e:
         self.assertTrue(e.request_id.startswith('req_'))
Example #2
0
 async def test_raise(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     await self.assertRaisesAsync(aiostripe.error.CardError,
                                  aiostripe.Charge.create,
                                  amount=100,
                                  currency='usd',
                                  card=EXPIRED_CARD)
 async def test_declined_card_props(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     try:
         await aiostripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
     except aiostripe.error.CardError as e:
         self.assertEqual(402, e.http_status)
         self.assertTrue(isinstance(e.http_body, str))
         self.assertTrue(isinstance(e.json_body, dict))
         self.assertTrue(e.request_id.startswith('req_'))
Example #4
0
 async def test_response_headers(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     try:
         await aiostripe.Charge.create(amount=100,
                                       currency='usd',
                                       card=EXPIRED_CARD)
         self.fail('charge creation with expired card did not fail')
     except aiostripe.error.CardError as e:
         self.assertTrue(e.request_id.startswith('req_'))
Example #5
0
 async def test_declined_card_props(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     try:
         await aiostripe.Charge.create(amount=100,
                                       currency='usd',
                                       card=EXPIRED_CARD)
     except aiostripe.error.CardError as e:
         self.assertEqual(402, e.http_status)
         self.assertTrue(isinstance(e.http_body, str))
         self.assertTrue(isinstance(e.json_body, dict))
         self.assertTrue(e.request_id.startswith('req_'))
 async def test_raise(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     await self.assertRaisesAsync(aiostripe.error.CardError, aiostripe.Charge.create, amount=100, currency='usd',
                                  card=EXPIRED_CARD)