Merge branch 'maint'

This commit is contained in:
John Ralls committed 2020-04-13 11:27:14 -07:00
commit 3ca8fa1229
92 files changed
+5748 -10888

No files matched your search

+2 -1
View File
@@ -5,7 +5,7 @@ if (WITH_PYTHON)
# Because it hasn't been built yet
set(test_core_dir ${CMAKE_BINARY_DIR}/common/test-core)
endif()
add_custom_target(test-python-bindings ALL DEPENDS unittest_support gnucash-core-c-build gnucash-core-c-py)
add_custom_target(test-python-bindings ALL DEPENDS unittest_support gnucash-core-c-build gnucash-core-c-py sw_app_utils)
add_dependencies(check test-python-bindings)
add_test(python-bindings ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runTests.py.in)
set_property(TEST python-bindings PROPERTY ENVIRONMENT
@@ -21,6 +21,7 @@ set(test_python_bindings_DATA
test_business.py
test_commodity.py
test_numeric.py
test_session.py
test_split.py
test_transaction.py
test_query.py)
+1
View File
@@ -5,6 +5,7 @@ import os
os.environ["GNC_UNINSTALLED"] = "1"
from test_session import TestSession
from test_book import TestBook
from test_account import TestAccount
from test_split import TestSplit
+2 -2
View File
@@ -5,12 +5,12 @@ from gnucash import Book, Account, Split, GncCommodity, GncNumeric, \
from test_book import BookSession
class AccountSession( BookSession ):
class AccountSession(BookSession):
def setUp(self):
BookSession.setUp(self)
self.account = Account(self.book)
class TestAccount( AccountSession ):
class TestAccount(AccountSession):
def test_name(self):
NAME = "Money"
self.assertEqual( '', self.account.GetName() )
+2 -2
View File
@@ -2,14 +2,14 @@ from unittest import TestCase, main
from gnucash import Session
class BookSession( TestCase ):
class BookSession(TestCase):
def setUp(self):
self.ses = Session()
self.book = self.ses.get_book()
self.table = self.book.get_table()
self.currency = self.table.lookup('CURRENCY', 'EUR')
class TestBook( BookSession ):
class TestBook(BookSession):
def test_markclosed(self):
self.ses.end()
+2 -2
View File
@@ -9,7 +9,7 @@ from gnucash.gnucash_business import Vendor, Employee, Customer, Job, Invoice, E
from test_book import BookSession
class BusinessSession( BookSession ):
class BusinessSession(BookSession):
def setUp(self):
BookSession.setUp(self)
@@ -43,7 +43,7 @@ class BusinessSession( BookSession ):
self.invoice.PostToAccount(self.receivable,
self.today, self.today, "", True, False)
class TestBusiness( BusinessSession ):
class TestBusiness(BusinessSession):
def test_equal(self):
self.assertTrue( self.vendor.Equal( self.vendor.GetVendor() ) )
self.assertTrue( self.customer.Equal( self.job.GetOwner() ) )
+3 -3
View File
@@ -2,7 +2,7 @@ from unittest import TestCase, main
from gnucash import Session
class CommoditySession( TestCase ):
class CommoditySession(TestCase):
def setUp(self):
self.ses = Session()
self.book = self.ses.get_book()
@@ -11,12 +11,12 @@ class CommoditySession( TestCase ):
def tearDown(self):
self.ses.end()
class TestCommodity( CommoditySession ):
class TestCommodity(CommoditySession):
def test_iso_currency(self):
eur = self.table.lookup('CURRENCY', 'EUR')
self.assertIsNotNone(eur)
class TestCommodityNamespace( CommoditySession ):
class TestCommodityNamespace(CommoditySession):
def test_namespaces(self):
#print(self.table.__class__)
namespace_names = self.table.get_namespaces()
+1 -1
View File
@@ -3,7 +3,7 @@ from unittest import TestCase, main
from gnucash import GncNumeric, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED, \
GNC_HOW_RND_NEVER, GNC_HOW_RND_FLOOR, GNC_HOW_RND_CEIL
class TestGncNumeric( TestCase ):
class TestGncNumeric(TestCase):
def test_defaut(self):
num = GncNumeric()
self.assertEqual(str(num), "0/1")
+34
View File
@@ -0,0 +1,34 @@
# test cases for Session wrapper object
#
# test for get_book may belong in test_book but it makes sense here
# to see if get_current_session works
# test for app_utils on the other hand could go to a subfolder of
# /libgnucash/app-utils
#
# @date 2020-04-03
# @author Christoph Holtermann <mail@c-holtermann.net>
from unittest import TestCase, main
from gnucash import Session
class TestSession(TestCase):
def test_create_empty_session(self):
self.ses = Session()
def test_app_utils_get_current_session(self):
from gnucash import _sw_app_utils
self.ses_instance = _sw_app_utils.gnc_get_current_session()
self.ses = Session(instance = self.ses_instance)
self.assertIsInstance(obj = self.ses, cls = Session)
def test_get_book_from_current_session(self):
from gnucash import _sw_app_utils
from gnucash import Book
self.ses_instance = _sw_app_utils.gnc_get_current_session()
self.ses = Session(instance = self.ses_instance)
self.book = self.ses.get_book()
self.assertIsInstance(obj = self.book, cls = Book)
if __name__ == '__main__':
main()
+2 -2
View File
@@ -5,7 +5,7 @@ from unittest_support import *
from test_book import BookSession
class SplitSession( BookSession ):
class SplitSession(BookSession):
def setUp(self):
BookSession.setUp(self)
@@ -14,7 +14,7 @@ class SplitSession( BookSession ):
def tearDown(self):
pass
class TestSplit( SplitSession ):
class TestSplit(SplitSession):
def test_memo(self):
MEMO = "cookie monster"
self.assertEqual( '', self.split.GetMemo() )
+2 -2
View File
@@ -5,7 +5,7 @@ from unittest_support import *
from test_book import BookSession
class TransactionSession( BookSession ):
class TransactionSession(BookSession):
def setUp(self):
self.domain1 = "gnc.engine"
self.domain2 = "gnc.engine.scrub"
@@ -40,7 +40,7 @@ class TransactionSession( BookSession ):
g_log_remove_handler(self.domain2, self.hdlr2)
test_clear_error_list ()
class TestTransaction( TransactionSession ):
class TestTransaction(TransactionSession):
def test_equal(self):
TRANS = self.trans
self.assertTrue( TRANS.Equal(self.trans, True, False, False, False) )