def setUp(self): super(_TestAMP, self).setUp() self.account = mommy.make("accounts.AccountDB", id=1) self.server = server.Evennia(MagicMock()) self.server.sessions.data_in = MagicMock() self.server.sessions.data_out = MagicMock() self.amp_client_factory = amp_client.AMPClientFactory(self.server) self.amp_client = self.amp_client_factory.buildProtocol("127.0.0.1") self.session = MagicMock() # serversession.ServerSession() self.session.sessid = 1 self.server.sessions[1] = self.session self.portal = portal.Portal(MagicMock()) self.portalsession = session.Session() self.portalsession.sessid = 1 self.portal.sessions[1] = self.portalsession self.portal.sessions.data_in = MagicMock() self.portal.sessions.data_out = MagicMock() self.amp_server_factory = amp_server.AMPServerFactory(self.portal) self.amp_server = self.amp_server_factory.buildProtocol("127.0.0.1")
if LOCKDOWN_MODE: INFO_DICT["lockdown_mode"] = ' LOCKDOWN_MODE active: Only local connections.' if AMP_ENABLED: # The AMP protocol handles the communication between # the portal and the mud server. Only reason to ever deactivate # it would be during testing and debugging. from evennia.server.portal import amp_server INFO_DICT["amp"] = 'amp: %s' % AMP_PORT factory = amp_server.AMPServerFactory(PORTAL) amp_service = internet.TCPServer(AMP_PORT, factory, interface=AMP_INTERFACE) amp_service.setName("PortalAMPServer") PORTAL.services.addService(amp_service) # We group all the various services under the same twisted app. # These will gradually be started as they are initialized below. if TELNET_ENABLED: # Start telnet game connections from evennia.server.portal import telnet for interface in TELNET_INTERFACES: