Completed tests of all GMCP/MSDP backend functions, including tickerhandler repeats and value monitoring, as per #924.

This commit is contained in:
Griatch 2016-04-06 19:26:14 +02:00
parent 4883512342
commit 1ac81205c3
2 changed files with 7 additions and 4 deletions

View file

@ -443,7 +443,7 @@ class TickerHandler(object):
kwargs["_callback"] = callfunc # either method-name or callable
self.ticker_pool.add(store_key, *args, **kwargs)
def remove(self, interval=60, callback=None, idstring=""):
def remove(self, interval=60, callback=None, idstring="", persistent=True):
"""
Remove object from ticker or only remove it from tickers with
a given interval.
@ -456,7 +456,7 @@ class TickerHandler(object):
"""
obj, path, callfunc = self._get_callback(callback)
store_key = self._store_key(obj, path, interval, callfunc, idstring)
store_key = self._store_key(obj, path, interval, callfunc, idstring, persistent)
to_remove = self.ticker_storage.pop(store_key, None)
if to_remove:
self.ticker_pool.remove(store_key)

View file

@ -277,7 +277,10 @@ def repeat(session, *args, **kwargs):
if kwargs.get("stop", False):
TICKER_HANDLER.remove(interval, _repeatable[name], idstring=session.sessid, persistent=False)
else:
TICKER_HANDLER.add(interval, _repeatable[name], idstring=session.sessid, persistent=False)
TICKER_HANDLER.add(interval, _repeatable[name], idstring=session.sessid, persistent=False, session=session)
else:
session.msg("Allowed repeating functions are: %s" % (", ".join(_repeatable)))
def unrepeat(session, *args, **kwargs):
@ -337,7 +340,7 @@ def unmonitor(session, *args, **kwargs):
# aliases for GMCP
gmcp_core_hello = client_options # Core.Hello
gmcp_core_supports_set = client_options # Core.Supports.Set
gmcp_core_supports_get = get_client_options # Core.Supports.Get
gmcp_core_supports_get = get_client_options # Evennia.Core.Supports.Get
gmcp_core_commands_get = get_inputfuncs # Core.Commands.Get
gmcp_char_login = login # Char.Login
gmcp_char_value_get = get_value # Char.Value.Get