Exemplo n.º 1
0
    def test_happy_path(self,
                        ctx,
                        mock_transaction_repository,
                        sample_transaction: Transaction,
                        transaction_manager: TransactionManager):
        mock_transaction_repository.search_by = MagicMock(return_value=([sample_transaction], 1))
        result, count = transaction_manager.search(ctx, limit=42, offset=2, terms='abc')

        assert [sample_transaction] == result
        assert 1 == count
        mock_transaction_repository.search_by.assert_called_once_with(ctx, limit=42, offset=2, terms='abc')
Exemplo n.º 2
0
 def test_limit_negative(self,
                         ctx,
                         transaction_manager: TransactionManager):
     with raises(IntMustBePositive):
         transaction_manager.search(ctx, limit=-1)