Ejemplo n.º 1
0
 def test_raise(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     self.assertRaises(stripe.error.CardError,
                       stripe.Charge.create,
                       amount=100,
                       currency='usd',
                       card=EXPIRED_CARD)
Ejemplo n.º 2
0
 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:
         stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
         self.fail('charge creation with expired card did not fail')
     except stripe.error.CardError as e:
         self.assertTrue(e.request_id.startswith('req_'))
 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:
         stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
         self.fail('charge creation with expired card did not fail')
     except stripe.error.CardError as e:
         self.assertTrue(e.request_id.startswith('req_'))
Ejemplo n.º 4
0
 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:
         stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
     except stripe.error.CardError, e:
         self.assertEqual(402, e.http_status)
         self.assertTrue(isinstance(e.http_body, basestring))
         self.assertTrue(isinstance(e.json_body, dict))
 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:
         stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
     except stripe.error.CardError, e:
         self.assertEqual(402, e.http_status)
         self.assertTrue(isinstance(e.http_body, basestring))
         self.assertTrue(isinstance(e.json_body, dict))
 def test_raise(self):
     EXPIRED_CARD = DUMMY_CARD.copy()
     EXPIRED_CARD['exp_month'] = NOW.month - 2
     EXPIRED_CARD['exp_year'] = NOW.year - 2
     self.assertRaises(stripe.error.CardError, stripe.Charge.create,
                       amount=100, currency='usd', card=EXPIRED_CARD)