mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 10:19:16 +02:00
add account.get_info()
This commit is contained in:
parent
36583a4b3b
commit
711ab664b4
3 changed files with 36 additions and 1 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue