diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index b804855e..5a8ab458 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -52,6 +52,17 @@ class Account(object): raise KeyError("{!r} not a valid config key, existing keys: {!r}".format( name, self._configkeys)) + def get_info(self): + """ return dictionary of built config parameters. """ + lines = from_dc_charpointer(lib.dc_get_info(self._dc_context)) + d = {} + for line in lines.split("\n"): + if not line.strip(): + continue + key, value = line.split("=", 1) + d[key.lower()] = value + return d + def set_config(self, name, value): """ set configuration values. diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 884c1396..778d1a80 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -5,6 +5,7 @@ import time from deltachat import Account from deltachat import props from deltachat.capi import lib +import tempfile def pytest_addoption(parser): @@ -15,6 +16,22 @@ def pytest_addoption(parser): ) +def pytest_report_header(config, startdir): + t = tempfile.mktemp() + try: + ac = Account(t) + info = ac.get_info() + del ac + finally: + os.remove(t) + return "Deltachat core={} rpgp={} openssl={} sqlite={}".format( + info["deltachat_core_version"], + info["rpgp_enabled"], + info['openssl_version'], + info['sqlite_version'], + ) + + @pytest.fixture(scope="session") def data(): class Data: diff --git a/python/tests/test_account.py b/python/tests/test_account.py index 4571e3ac..7194b040 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -7,6 +7,13 @@ from conftest import wait_configuration_progress, wait_successful_IMAP_SMTP_conn class TestOfflineAccount: + def test_getinfo(self, acfactory): + ac1 = acfactory.get_unconfigured_account() + d = ac1.get_info() + assert d["compile_date"] + assert d["arch"] + assert d["number_of_chats"] == "0" + def test_is_not_configured(self, acfactory): ac1 = acfactory.get_unconfigured_account() assert not ac1.is_configured() @@ -276,7 +283,7 @@ class TestOnlineAccount: lp.step("1") ac1._evlogger.get_matching("DC_EVENT_MSG_READ") lp.step("2") - ac1._evlogger.get_info_matching("Message marked as seen") + # ac1._evlogger.get_info_matching("Message marked as seen") assert msg_out.get_state().is_out_mdn_received() def test_saved_mime_on_received_message(self, acfactory, lp):