本文整理汇总了Python中user_sessions.backends.db.SessionStore.load方法的典型用法代码示例。如果您正苦于以下问题:Python SessionStore.load方法的具体用法?Python SessionStore.load怎么用?Python SessionStore.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user_sessions.backends.db.SessionStore
的用法示例。
在下文中一共展示了SessionStore.load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_modified
# 需要导入模块: from user_sessions.backends.db import SessionStore [as 别名]
# 或者: from user_sessions.backends.db.SessionStore import load [as 别名]
def test_load_modified(self):
self.store[auth.SESSION_KEY] = 1
self.store.save()
store2 = SessionStore('Python/3.3', '8.8.8.8', self.store.session_key)
store2.load()
self.assertEqual(store2.user_agent, 'Python/3.3')
self.assertEqual(store2.ip, '8.8.8.8')
self.assertEqual(store2.user_id, 1)
self.assertEqual(store2.modified, True)
示例2: test_load_unmodified
# 需要导入模块: from user_sessions.backends.db import SessionStore [as 别名]
# 或者: from user_sessions.backends.db.SessionStore import load [as 别名]
def test_load_unmodified(self):
self.store[auth.SESSION_KEY] = 1
self.store.save()
store2 = SessionStore("Python/2.7", "127.0.0.1", self.store.session_key)
store2.load()
self.assertEqual(store2.user_agent, "Python/2.7")
self.assertEqual(store2.ip, "127.0.0.1")
self.assertEqual(store2.user_id, 1)
self.assertEqual(store2.modified, False)
示例3: test_load_unmodified
# 需要导入模块: from user_sessions.backends.db import SessionStore [as 别名]
# 或者: from user_sessions.backends.db.SessionStore import load [as 别名]
def test_load_unmodified(self):
self.store[auth.SESSION_KEY] = 1
self.store.save()
store2 = SessionStore(session_key=self.store.session_key,
user_agent='Python/2.7', ip='127.0.0.1')
store2.load()
self.assertEqual(store2.user_agent, 'Python/2.7')
self.assertEqual(store2.ip, '127.0.0.1')
self.assertEqual(store2.user_id, 1)
self.assertEqual(store2.modified, False)