Пример #1
0
 def test_get_checkout_unauthorized(self):
     transaction = PagSeguroTransaction('dummy_token',
                                        '*****@*****.**',
                                        reference='reference',
                                        item=self.item)
     with self.assertRaises(UnauthorizedException):
         transaction.get_checkout_url()
Пример #2
0
 def test_get_checkout_without_code(self):
     transaction = PagSeguroTransaction('dummy_token',
                                        '*****@*****.**',
                                        reference='reference',
                                        item=self.item)
     with self.assertRaises(ApiErrorException):
         transaction.get_checkout_url()
Пример #3
0
 def test_get_checkout_url(self):
     transaction = PagSeguroTransaction('dummy_token',
                                        '*****@*****.**',
                                        reference='reference',
                                        item=self.item)
     self.assertIn('8CF4BE7DCECEF0F004A6DFA0A8243412',
                   transaction.get_checkout_url())
Пример #4
0
 def test_set_item(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_item(self.item)
     self.assertIn('itemId1', transaction.get_dados())
Пример #5
0
 def test_set_sender_info(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_sender('*****@*****.**', 'Comprador de teste')
     self.assertIn('senderEmail', transaction.get_dados())
     self.assertIn('senderName', transaction.get_dados())
Пример #6
0
 def test_get_dados_without_item(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.get_dados()
Пример #7
0
 def test_transaction_can_have_custom_reference(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**', reference='my-reference')
     self.assertEqual('my-reference', transaction.get_reference())
Пример #8
0
 def test_transaction_creates_reference(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     self.assertTrue(transaction.get_reference())
Пример #9
0
 def test_get_dados_without_item(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.get_dados()
Пример #10
0
 def test_set_discount_int(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     with self.assertRaises(ValueError):
         transaction.set_discount(114)
Пример #11
0
 def test_set_dicount(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_discount(1.14)
     self.assertIn('extraAmount', transaction.get_dados())
Пример #12
0
 def test_set_discount_int(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     with self.assertRaises(ValueError):
         transaction.set_discount(114)
Пример #13
0
 def test_set_redirect_url(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_redirect_url('urldeteste.com')
     self.assertIn('redirectURL', transaction.get_dados())
Пример #14
0
 def test_set_item(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_item(self.item)
     self.assertIn('itemId1', transaction.get_dados())
Пример #15
0
 def test_set_sender_info(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_sender('*****@*****.**', 'Comprador de teste')
     self.assertIn('senderEmail', transaction.get_dados())
     self.assertIn('senderName', transaction.get_dados())
Пример #16
0
 def test_set_redirect_url(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_redirect_url('urldeteste.com')
     self.assertIn('redirectURL', transaction.get_dados())
Пример #17
0
 def test_get_checkout_unauthorized(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**', reference='reference', item=self.item)
     with self.assertRaises(UnauthorizedException):
         transaction.get_checkout_url()
Пример #18
0
 def test_set_dicount(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     transaction.set_discount(1.14)
     self.assertIn('extraAmount', transaction.get_dados())
Пример #19
0
 def test_transaction_creates_reference(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     self.assertTrue(transaction.get_reference())
Пример #20
0
 def test_get_checkout_url(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**', reference='reference', item=self.item)
     self.assertIn('8CF4BE7DCECEF0F004A6DFA0A8243412', transaction.get_checkout_url())
Пример #21
0
 def test_transaction_can_have_custom_reference(self):
     transaction = PagSeguroTransaction('dummy_token',
                                        '*****@*****.**',
                                        reference='my-reference')
     self.assertEqual('my-reference', transaction.get_reference())
Пример #22
0
 def test_get_checkout_without_code(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**', reference='reference', item=self.item)
     with self.assertRaises(ApiErrorException):
         transaction.get_checkout_url()
Пример #23
0
 def test_can_instantiate(self):
     transaction = PagSeguroTransaction('dummy_token', '*****@*****.**')
     self.assertIsInstance(transaction, PagSeguroTransaction)