mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 07:32:12 +03:00
make eventlogger module a global plugin
This commit is contained in:
@@ -230,8 +230,8 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, datadir):
|
||||
configdict.update(config)
|
||||
configdict["mvbox_watch"] = str(int(mvbox))
|
||||
configdict["mvbox_move"] = "1"
|
||||
ac.configure(**configdict)
|
||||
ac.start_threads()
|
||||
ac.update_config(configdict)
|
||||
ac.start()
|
||||
return ac
|
||||
|
||||
def get_one_online_account(self, pre_generated_key=True):
|
||||
@@ -257,14 +257,14 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, datadir):
|
||||
self._preconfigure_key(ac, account.get_config("addr"))
|
||||
ac._evtracker.init_time = self.init_time
|
||||
ac._evtracker.set_timeout(30)
|
||||
ac.configure(
|
||||
ac.update_config(dict(
|
||||
addr=account.get_config("addr"),
|
||||
mail_pw=account.get_config("mail_pw"),
|
||||
mvbox_watch=account.get_config("mvbox_watch"),
|
||||
mvbox_move=account.get_config("mvbox_move"),
|
||||
sentbox_watch=account.get_config("sentbox_watch"),
|
||||
)
|
||||
ac.start_threads()
|
||||
))
|
||||
ac.start()
|
||||
return ac
|
||||
|
||||
am = AccountMaker()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import print_function
|
||||
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback
|
||||
from deltachat.hookspec import account_hookimpl
|
||||
from deltachat import register_global_plugin
|
||||
from deltachat.hookspec import account_hookimpl, global_hookimpl
|
||||
from deltachat.capi import ffi
|
||||
from deltachat.capi import lib
|
||||
|
||||
@@ -24,14 +25,14 @@ def test_dc_close_events(tmpdir, acfactory):
|
||||
shutdowns = []
|
||||
|
||||
class ShutdownPlugin:
|
||||
@account_hookimpl
|
||||
def after_shutdown(self):
|
||||
assert not hasattr(ac1, "_dc_context")
|
||||
shutdowns.append(1)
|
||||
ac1.add_account_plugin(ShutdownPlugin())
|
||||
@global_hookimpl
|
||||
def account_after_shutdown(self, account):
|
||||
assert account._dc_context is None
|
||||
shutdowns.append(account)
|
||||
register_global_plugin(ShutdownPlugin())
|
||||
assert hasattr(ac1, "_dc_context")
|
||||
ac1.shutdown()
|
||||
assert shutdowns == [1]
|
||||
assert shutdowns == [ac1]
|
||||
|
||||
def find(info_string):
|
||||
evlog = ac1._evtracker
|
||||
|
||||
Reference in New Issue
Block a user