Ejemplo n.º 1
0
 def test_cannot_validate_nonpending(self,
                     ctx,
                                     mock_transaction_repository: TransactionRepository,
                     sample_transaction: Transaction,
                     transaction_manager: TransactionManager):
     # When...
     mock_transaction_repository.get_by_id = MagicMock(return_value=(sample_transaction))
     with raises(UserInputError):
         transaction_manager.validate(ctx, **{"id": sample_transaction.id})
Ejemplo n.º 2
0
    def test_happy_path(self,
                        ctx,
                        mock_transaction_repository,
                        sample_transaction_pending: Transaction,
                        transaction_manager: TransactionManager):
        # When...
        mock_transaction_repository.get_by_id = MagicMock(return_value=(sample_transaction_pending))
        transaction_manager.validate(ctx, **{"id": sample_transaction_pending.id})

        # Expect...
        mock_transaction_repository.validate.assert_called_once_with(ctx, sample_transaction_pending.id)