mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 18:29:19 +02:00
introduce get_config() helper
This commit is contained in:
parent
c02abb8a61
commit
a244393860
2 changed files with 9 additions and 4 deletions
|
@ -27,6 +27,8 @@ class EventHandler:
|
|||
def dc_event_http_get(self, data1, data2):
|
||||
url = data1
|
||||
content = self.read_url(url)
|
||||
if not isinstance(content, bytes):
|
||||
content = content.encode("utf8")
|
||||
# we need to return a fresh pointer that the core owns
|
||||
return capi.lib.dupstring_helper(content)
|
||||
|
||||
|
@ -53,6 +55,11 @@ class Account:
|
|||
value = value.encode("utf8")
|
||||
capi.lib.dc_set_config(self.dc_context, name, value)
|
||||
|
||||
def get_config(self, name):
|
||||
name = name.encode("utf8")
|
||||
res = capi.lib.dc_get_config(self.dc_context, name, b'')
|
||||
return capi.ffi.string(res).decode("utf8")
|
||||
|
||||
def start(self):
|
||||
deltachat.set_context_callback(self.dc_context, self.process_event)
|
||||
capi.lib.dc_configure(self.dc_context)
|
||||
|
|
|
@ -10,7 +10,7 @@ except ImportError:
|
|||
class TestLive:
|
||||
def test_basic_configure_login_ok(self, acfactory):
|
||||
q = Queue()
|
||||
acfactory.get_live_account(logcallback=q.put)
|
||||
ac1 = acfactory.get_live_account(logcallback=q.put)
|
||||
imap_ok = smtp_ok = False
|
||||
while not imap_ok or not smtp_ok:
|
||||
evt_name, data1, data2 = q.get(timeout=5.0)
|
||||
|
@ -22,6 +22,4 @@ class TestLive:
|
|||
imap_ok = True
|
||||
if re.match("smtp-login.*ok.", data2.lower()):
|
||||
smtp_ok = True
|
||||
|
||||
def test_message_send_receive(self, acfactory):
|
||||
pass
|
||||
assert ac1.get_config("mail_pw")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue