Ejemplo n.º 1
0
def test_should_show(app):
    with app.test_request_context('/'):
        app.preprocess_request()
        assert should_show(g.api.root_account) is True

        assert should_show(g.api.root_account) is True
    with app.test_request_context('/?time=2100'):
        app.preprocess_request()
        assert not g.api.fava_options['show-accounts-with-zero-balance']
        assert should_show(g.api.root_account) is True
        empty_account = realization.get(g.api.root_account, 'Expenses')
        assert should_show(empty_account) is False
Ejemplo n.º 2
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
Ejemplo n.º 3
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
Ejemplo n.º 4
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