Files @ 71f50a6cf864
Branch filter:

Location: NPO-Accounting/conservancy_beancount/tests/test_reports_balance_sheet.py - annotation

Brett Smith
data: Bugfix is_opening_balance_txn() for donations from equity. RT#13516

Opening balance transactions should only include opening equity
accounts and non-equity accounts. Reflect that in the test.
"""test_reports_balance_sheet.py - Unit tests for balance sheet report"""
# Copyright © 2020  Brett Smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

import datetime
import io
import itertools

import pytest

from . import testutil

import odf.opendocument

from conservancy_beancount.reports import balance_sheet

clean_account_meta = pytest.fixture(scope='module')(testutil.clean_account_meta)

def run_main(arglist=[], config=None):
    if config is None:
        config = testutil.TestConfig(books_path=testutil.test_path('books/fund.beancount'))
    stdout = io.BytesIO()
    stderr = io.StringIO()
    retcode = balance_sheet.main(['-O', '-'] + arglist, stdout, stderr, config)
    stdout.seek(0)
    stderr.seek(0)
    return retcode, stdout, stderr

def test_main():
    retcode, stdout, stderr = run_main()
    assert retcode == 0
    assert not stderr.getvalue()
    report = odf.opendocument.load(stdout)
    assert report.spreadsheet.childNodes