~trufas/ledgeroni

ref: 97851fc857fedc648e6c5165fc587bce4354bb9f ledgeroni/tests/integration/test_balance.py -rw-r--r-- 921 bytes
97851fc8 — Rafael Castillo propery filter in balance command 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from click.testing import CliRunner
from ledgeroni.cli import cli


def test_balance():
    "Tests the balance command without any options"
    runner = CliRunner()
    result = runner.invoke(cli, [
        '-f', 'tests/sample_data/index.ledger', '--price-db',
        'tests/sample_data/prices_db', 'balance'])
    assert result.exit_code == 0


def test_bal_alias():
    "Makes sure the balance alias is registered"
    runner = CliRunner()
    result = runner.invoke(cli, [
        '-f', 'tests/sample_data/index.ledger', '--price-db',
        'tests/sample_data/prices_db', 'bal'])
    assert result.exit_code == 0
    assert "1.50 BTC  Asset:Bitcoin Wallet" in result.output


def test_without_ledger():
    "Throws an error when no ledger file is specified"
    runner = CliRunner()
    result = runner.invoke(cli, [
        '--price-db', 'tests/sample_data/prices_db', 'balance'])
    assert result.exit_code == 2