Esempio n. 1
0
 def test_process_payment_result_init(self):
     """Test ProcessPaymentResult __init__."""
     self.assertEqual(ProcessPaymentResult(True).result, True)
     self.assertEqual(ProcessPaymentResult(False).result, False)
     self.assertEqual(ProcessPaymentResult(True).error, None)
     self.assertEqual(
         ProcessPaymentResult(True, PaymentProcessingError.DUPLICITY).error,
         PaymentProcessingError.DUPLICITY)
Esempio n. 2
0
 def test_process_payment_result_eq(self):
     """Test ProcessPaymentResult __eq__."""
     self.assertEqual(
         ProcessPaymentResult(True) == ProcessPaymentResult(True), True)
     self.assertEqual(
         ProcessPaymentResult(True) == ProcessPaymentResult(False), False)
     self.assertEqual(ProcessPaymentResult(False) == 0, False)
     self.assertEqual(
         ProcessPaymentResult(False) == ProcessPaymentResult(
             False, PaymentProcessingError.DUPLICITY), False)
Esempio n. 3
0
 def assign_payment(self, payment, client_id, tax_date):
     return ProcessPaymentResult(result=True)
Esempio n. 4
0
 def assign_payment(self, payment, client_id):
     return ProcessPaymentResult(result=False)
Esempio n. 5
0
 def process_payments(self, payments):
     for payment in payments:
         yield ProcessPaymentResult(result=False,
                                    error=PaymentProcessingError.DUPLICITY)
Esempio n. 6
0
 def process_payments(self, payments):
     for payment in payments:
         yield ProcessPaymentResult(result=False)
Esempio n. 7
0
 def mock_process_payments(payments):
     processing_started.set()
     query_finished.wait()
     return [ProcessPaymentResult(result=True) for p in payments]
Esempio n. 8
0
 def test_assign_payment(self):
     """Test assign_payment."""
     self.assertEqual(self.processor.assign_payment(self.payment, ''),
                      ProcessPaymentResult(True))
Esempio n. 9
0
 def test_process_payments(self):
     """Test process_payments."""
     self.assertEqual(list(self.processor.process_payments([self.payment])),
                      [ProcessPaymentResult(False)])