Esempio n. 1
0
 def test_get_all_transaction(self):
     pagarme = Pygarme(self.api_key)
     transactions = pagarme.all_transactions(page=2,count=3)
     self.assertTrue(len(transactions) == 1)
Esempio n. 2
0
 def test_get_all_transaction_fails(self):
     pagarme = Pygarme(self.api_key)
     with self.assertRaises(PygarmeApiError):
         transactions = pagarme.all_transactions(page=2,count=3)
Esempio n. 3
0
 def test_start_transaction_invalid_installments(self):
     pagarme = Pygarme(self.api_key)
     with self.assertRaises(ValueError):
         transaction = pagarme.start_transaction(amount=314, card_hash='hashcard', installments=0)
Esempio n. 4
0
 def test_find_transaction_by_id(self):
     pagarme = Pygarme(self.api_key)
     transaction = pagarme.find_transaction_by_id(314)
     self.assertIsInstance(transaction, Transaction)
Esempio n. 5
0
 def test_start_transaction_invalid_payment_method(self):
     pagarme = Pygarme(self.api_key)
     with self.assertRaises(ValueError):
         transaction = pagarme.start_transaction(amount=314, card_hash='hashcard', payment_method='rice_bag')
Esempio n. 6
0
 def test_start_transaction_invalid_amount(self):
     pagarme = Pygarme(self.api_key)
     with self.assertRaises(ValueError):
         transaction = pagarme.start_transaction(amount=None, card_hash='hashcard')
Esempio n. 7
0
 def test_start_transaction(self):
     pagarme = Pygarme(self.api_key)
     transaction = pagarme.start_transaction(amount=314, card_hash='hashcard')
     self.assertIsInstance(transaction, Transaction)
Esempio n. 8
0
 def test_invalid_api(self):
     with self.assertRaises(ValueError):
         pagarme = Pygarme('')
Esempio n. 9
0
 def test_can_instantiate(self):
     pagarme = Pygarme(self.api_key)
     self.assertIsInstance(pagarme, Pygarme)