Example #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)
Example #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)
Example #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)
Example #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)
Example #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')
Example #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')
Example #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)
Example #8
0
 def test_invalid_api(self):
     with self.assertRaises(ValueError):
         pagarme = Pygarme('')
Example #9
0
 def test_can_instantiate(self):
     pagarme = Pygarme(self.api_key)
     self.assertIsInstance(pagarme, Pygarme)