Fixing lots of tests.

This commit is contained in:
Andrew Bastien 2023-11-22 15:26:07 -05:00
parent 15653ef1f1
commit 2dbd90d415
9 changed files with 214 additions and 192 deletions

View file

@ -132,7 +132,7 @@ class PortalSessionHandler(SessionHandler):
now = time.time()
if (
now - self.connection_last < _MIN_TIME_BETWEEN_CONNECTS
) or not evennia.EVENNIA_SERVICE.amp_protocol:
) or not evennia.EVENNIA_PORTAL_SERVICE.amp_protocol:
if not session or not self.connection_task:
self.connection_task = reactor.callLater(
_MIN_TIME_BETWEEN_CONNECTS, self.connect, None
@ -156,7 +156,7 @@ class PortalSessionHandler(SessionHandler):
self[session.sessid] = session
session.server_connected = True
evennia.EVENNIA_SERVICE.amp_protocol.send_AdminPortal2Server(
evennia.EVENNIA_PORTAL_SERVICE.amp_protocol.send_AdminPortal2Server(
session, operation=PCONN, sessiondata=sessdata
)
@ -175,7 +175,7 @@ class PortalSessionHandler(SessionHandler):
# once to the server - if so we must re-sync woth the server, otherwise
# we skip this step.
sessdata = session.get_sync_data()
if evennia.EVENNIA_SERVICE.amp_protocol:
if evennia.EVENNIA_PORTAL_SERVICE.amp_protocol:
# we only send sessdata that should not have changed
# at the server level at this point
sessdata = dict(
@ -192,7 +192,7 @@ class PortalSessionHandler(SessionHandler):
"server_data",
)
)
evennia.EVENNIA_SERVICE.amp_protocol.send_AdminPortal2Server(
evennia.EVENNIA_PORTAL_SERVICE.amp_protocol.send_AdminPortal2Server(
session, operation=PCONNSYNC, sessiondata=sessdata
)
@ -222,13 +222,17 @@ class PortalSessionHandler(SessionHandler):
del self[session.sessid]
# Tell the Server to disconnect its version of the Session as well.
evennia.EVENNIA_SERVICE.amp_protocol.send_AdminPortal2Server(session, operation=PDISCONN)
evennia.EVENNIA_PORTAL_SERVICE.amp_protocol.send_AdminPortal2Server(
session, operation=PDISCONN
)
def disconnect_all(self):
"""
Disconnect all sessions, informing the Server.
"""
if settings._TEST_ENVIRONMENT:
return
def _callback(result, sessionhandler):
# we set a watchdog to stop self.disconnect from deleting
@ -240,7 +244,8 @@ class PortalSessionHandler(SessionHandler):
# inform Server; wait until finished sending before we continue
# removing all the sessions.
evennia.EVENNIA_SERVICE.amp_protocol.send_AdminPortal2Server(
evennia.EVENNIA_PORTAL_SERVICE.amp_protocol.send_AdminPortal2Server(
DUMMYSESSION, operation=PDISCONNALL
).addCallback(_callback, self)
@ -434,7 +439,7 @@ class PortalSessionHandler(SessionHandler):
self.data_out(session, text=[[_ERROR_COMMAND_OVERFLOW], {}])
return
if not evennia.EVENNIA_SERVICE.amp_protocol:
if not evennia.EVENNIA_PORTAL_SERVICE.amp_protocol:
# this can happen if someone connects before AMP connection
# was established (usually on first start)
reactor.callLater(1.0, self.data_in, session, **kwargs)
@ -445,7 +450,7 @@ class PortalSessionHandler(SessionHandler):
# relay data to Server
session.cmd_last = now
evennia.EVENNIA_SERVICE.amp_protocol.send_MsgPortal2Server(session, **kwargs)
evennia.EVENNIA_PORTAL_SERVICE.amp_protocol.send_MsgPortal2Server(session, **kwargs)
# eventual local echo (text input only)
if "text" in kwargs and session.protocol_flags.get("LOCALECHO", False):