mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
tests for session
This commit is contained in:
parent
daff201ffb
commit
43cebedd3d
@ -5,6 +5,7 @@ import os
|
|||||||
|
|
||||||
os.environ["GNC_UNINSTALLED"] = "1"
|
os.environ["GNC_UNINSTALLED"] = "1"
|
||||||
|
|
||||||
|
from test_session import TestSession
|
||||||
from test_book import TestBook
|
from test_book import TestBook
|
||||||
from test_account import TestAccount
|
from test_account import TestAccount
|
||||||
from test_split import TestSplit
|
from test_split import TestSplit
|
||||||
|
34
bindings/python/tests/test_session.py
Normal file
34
bindings/python/tests/test_session.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user