本文整理汇总了Python中src.server.sessionhandler.SESSIONS.login方法的典型用法代码示例。如果您正苦于以下问题:Python SESSIONS.login方法的具体用法?Python SESSIONS.login怎么用?Python SESSIONS.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.server.sessionhandler.SESSIONS
的用法示例。
在下文中一共展示了SESSIONS.login方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from src.server.sessionhandler import SESSIONS [as 别名]
# 或者: from src.server.sessionhandler.SESSIONS import login [as 别名]
def setUp(self):
"sets up testing environment"
settings.DEFAULT_HOME = "#2"
# print "creating player %i: %s" % (self.CID, self.__class__.__name__)
self.player = create.create_player(
"TestPlayer%i" % self.CID, "[email protected]", "testpassword", typeclass=TestPlayerClass
)
self.player2 = create.create_player(
"TestPlayer%ib" % self.CID, "[email protected]", "testpassword", typeclass=TestPlayerClass
)
self.room1 = create.create_object("src.objects.objects.Room", key="Room%i" % self.CID, nohome=True)
self.room1.db.desc = "room_desc"
self.room2 = create.create_object("src.objects.objects.Room", key="Room%ib" % self.CID)
self.obj1 = create.create_object(TestObjectClass, key="Obj%i" % self.CID, location=self.room1, home=self.room1)
self.obj2 = create.create_object(TestObjectClass, key="Obj%ib" % self.CID, location=self.room1, home=self.room1)
self.char1 = create.create_object(
TestCharacterClass, key="Char%i" % self.CID, location=self.room1, home=self.room1
)
self.char1.permissions.add("Immortals")
self.char2 = create.create_object(
TestCharacterClass, key="Char%ib" % self.CID, location=self.room1, home=self.room1
)
self.char1.player = self.player
self.char2.player = self.player2
self.script = create.create_script("src.scripts.scripts.Script", key="Script%i" % self.CID)
self.player.permissions.add("Immortals")
# set up a fake session
global SESSIONS
session = ServerSession()
session.init_session("telnet", ("localhost", "testmode"), SESSIONS)
session.sessid = self.CID
SESSIONS.portal_connect(session.get_sync_data())
SESSIONS.login(SESSIONS.session_from_sessid(self.CID), self.player, testmode=True)