示例#1
0
def test_query_to_file(example_ledger):
    query_shell = QueryShell(example_ledger)

    name, data = query_shell.query_to_file("balances", "csv")
    assert name == "query_result"
    csv = data_file("example-balances.csv")
    with open(csv, "rb") as file:
        assert data.getvalue() == file.read()

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file("select sdf", "csv")

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file("run testsetest", "csv")
示例#2
0
def test_query_to_file(example_ledger):
    query_shell = QueryShell(example_ledger)

    name, data = query_shell.query_to_file('balances', 'csv')
    assert name == 'query_result'
    csv = os.path.join(os.path.dirname(__file__), 'data/example-balances.csv')
    with open(csv, 'rb') as file:
        assert data.getvalue() == file.read()

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file('select sdf', 'csv')

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file('run testsetest', 'csv')
示例#3
0
def test_query_to_file(example_ledger):
    query_shell = QueryShell(example_ledger)

    name, data = query_shell.query_to_file('balances', 'csv')
    assert name == 'query_result'
    csv = data_file('example-balances.csv')
    with open(csv, 'rb') as file:
        assert data.getvalue() == file.read()

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file('select sdf', 'csv')

    with pytest.raises(FavaAPIException):
        query_shell.query_to_file('run testsetest', 'csv')