Ejemplo n.º 1
0
 def test_release_throws_exception_if_not_ESCROWED(self):
     payment = Payment(**self.payment_arguments)
     for state in PAYMENT_STATES:
         if state == 'ESCROWED':
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentReleaseError):
             payment.release()
Ejemplo n.º 2
0
 def test_escrow_throws_exception_if_not_AUTHORIZED(self):
     payment = Payment(**self.payment_arguments)
     for state in PAYMENT_STATES:
         if state == 'AUTHORIZED':
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentEscrowError):
             payment.escrow()
Ejemplo n.º 3
0
 def test_release_throws_exception_if_not_ESCROWED(self):
     payment = Payment(**self.payment_arguments)
     for state in PAYMENT_STATES:
         if state == 'ESCROWED':
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentReleaseError):
             payment.release()
Ejemplo n.º 4
0
 def test_escrow_throws_exception_if_not_AUTHORIZED(self):
     payment = Payment(**self.payment_arguments)
     for state in PAYMENT_STATES:
         if state == 'AUTHORIZED':
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentEscrowError):
             payment.escrow()
Ejemplo n.º 5
0
 def test_cancel_throws_exception_if_not_ESCROWED(self):
     payment = Payment(**self.payment_arguments)
     applicable_states = (
         'CREATED',
         'AUTHORIZED',
         'ESCROWED',
     )
     for state in PAYMENT_STATES:
         if state in applicable_states:
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentCancelError) as e:
             payment.cancel()
         exc = e.exception
         self.assertEqual(
             exc.args[0],
             'Payment state is {}. Only {} payments may be {}'.format(
                 state, ', '.join(applicable_states), 'CANCELED'))
Ejemplo n.º 6
0
 def test_cancel_throws_exception_if_not_ESCROWED(self):
     payment = Payment(**self.payment_arguments)
     applicable_states = ('CREATED', 'AUTHORIZED', 'ESCROWED',)
     for state in PAYMENT_STATES:
         if state in applicable_states:
             continue
         payment.state = state
         with self.assertRaises(poundpay.payments.PaymentCancelError) as e:
             payment.cancel()
         exc = e.exception
         self.assertEqual(
             exc.args[0],
              'Payment state is {}. Only {} payments may be {}'.format(
                  state,
                  ', '.join(applicable_states),
                  'CANCELED'
                  )
             )