1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-05 02:29:28 +02:00

added a more general way to configure live test accounts for testing

This commit is contained in:
holger krekel 2018-09-07 19:10:14 +02:00
parent 940f665b54
commit c02abb8a61
5 changed files with 67 additions and 39 deletions

View file

@ -35,14 +35,14 @@ class EventHandler:
class Account:
def __init__(self, db_path, logcallback=eventprinter, eventhandler=None):
def __init__(self, db_path, logcallback=None, eventhandler=None):
self.dc_context = ctx = capi.lib.dc_context_new(
capi.lib.py_dc_callback,
capi.ffi.NULL, capi.ffi.NULL)
if hasattr(db_path, "encode"):
db_path = db_path.encode("utf8")
capi.lib.dc_open(ctx, db_path, capi.ffi.NULL)
self._logcallback = logcallback or (lambda *args: None)
self._logcallback = logcallback or eventprinter
if eventhandler is None:
eventhandler = EventHandler(self.dc_context)
self._eventhandler = eventhandler