Esempio n. 1
0
def test_should_show(app):
    with app.test_request_context('/'):
        app.preprocess_request()
        assert should_show(g.ledger.root_tree.get('')) is True
        assert should_show(g.ledger.root_tree.get('Expenses')) is True

        account = TreeNode('name')
        assert should_show(account) is False
        account.balance_children = CounterInventory({('USD', None): 9})
        assert should_show(account) is True
    with app.test_request_context('/?time=2100'):
        app.preprocess_request()
        assert not g.ledger.fava_options['show-accounts-with-zero-balance']
        assert should_show(g.ledger.root_tree.get('')) is True
        assert should_show(g.ledger.root_tree.get('Expenses')) is False
Esempio n. 2
0
def test_should_show(app):
    with app.test_request_context("/long-example/"):
        app.preprocess_request()
        assert should_show(g.ledger.root_tree.get("")) is True
        assert should_show(g.ledger.root_tree.get("Expenses")) is True

        account = TreeNode("name")
        assert should_show(account) is False
        account.balance_children = CounterInventory({("USD", None): 9})
        assert should_show(account) is True
    with app.test_request_context("/long-example/income_statement/?time=2100"):
        app.preprocess_request()
        assert not g.ledger.fava_options["show-accounts-with-zero-balance"]
        assert should_show(g.ledger.root_tree.get("")) is True
        assert should_show(g.ledger.root_tree.get("Expenses")) is False
Esempio n. 3
0
def test_should_show(app: Flask) -> None:
    with app.test_request_context("/long-example/"):
        app.preprocess_request()
        assert should_show(g.filtered.root_tree.get("")) is True
        assert should_show(g.filtered.root_tree.get("Expenses")) is True

        account = TreeNode("name")
        assert should_show(account) is False
        account.balance_children = CounterInventory({("USD", None): D("9")})
        assert should_show(account) is True
    with app.test_request_context("/long-example/income_statement/?time=2100"):
        app.preprocess_request()
        assert not g.ledger.fava_options.show_accounts_with_zero_balance
        assert should_show(g.filtered.root_tree.get("")) is True
        assert should_show(g.filtered.root_tree.get("Expenses")) is False