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()
def test_escrow_sets_state_to_escrowed_and_issues_save(self): kwargs = self.payment_arguments kwargs['state'] = 'AUTHORIZED' payment = Payment(**kwargs) with mock.patch.object(Payment, 'save') as patched_save: payment.escrow() patched_save.assert_called_once_with() self.assertEqual(payment.state, 'ESCROWED')