diff --git a/tests/test_hook_ledger_entry.py b/tests/test_hook_ledger_entry.py index feb876c05f24892e5b0338ecbd7f9068b5ef5334..fd233929f040bb7dd62b843d2ee68ed4f38b1863 100644 --- a/tests/test_hook_ledger_entry.py +++ b/tests/test_hook_ledger_entry.py @@ -182,6 +182,23 @@ def test_line1_not_custom_payee(): " Income:Donations -15.00 USD", ] +@pytest.mark.parametrize('amount,expect_fee', [ + (40, 3), + (80, 6), +]) +def test_conditional(amount, expect_fee): + expect_cash = amount - expect_fee + amount_s = '{:.02f}'.format(amount) + render_vars = template_vars('Buyer', amount_s) + lines = render_lines(render_vars, 'Conditional') + assert lines == [ + "", + "2015/03/14 Buyer", + " Assets:Cash {:.02f} USD".format(expect_cash), + " Expenses:Banking Fees {:.02f} USD".format(expect_fee), + " Income:Sales -{} USD".format(amount_s), + ] + @pytest.mark.parametrize('amount_expr', [ '', 'name',