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