本文整理汇总了Python中DBManager.DBManager.setSessionPeriod方法的典型用法代码示例。如果您正苦于以下问题:Python DBManager.setSessionPeriod方法的具体用法?Python DBManager.setSessionPeriod怎么用?Python DBManager.setSessionPeriod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.setSessionPeriod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TESTS
# 需要导入模块: from DBManager import DBManager [as 别名]
# 或者: from DBManager.DBManager import setSessionPeriod [as 别名]
print "(=) Testing Failure of createSession function"
try:
db.createSession(ses)
print "\t(-) Failure of createSession Test Failed"
except SessionError as se:
print "\t(+) Failure of createSession Test Passed. Error Caught:", se.msg
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing Failure of getSession function"
try:
db.getSession('invalidphrase')
print "\t(-) Failure of getSession Test Failed"
except SessionError as se:
print "\t(+) Failure of getSession Test Passed. Error Caught:", se.msg
#---------------------------------------------------------------------------------------------------------#
print "(=) Setting period of %s to 1 day." % ses
db.setSessionPeriod(ses, 1)
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing Failure of setSessionPeriod function"
try:
db.setSessionPeriod(ses, 'invalid duration')
print "\t(-) Failure of setSessionPeriod Test Failed"
except ValueError as ve:
print "\t(+) Failure of setSessionPeriod Test Passed. Error Caught:", ve
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing getSessions function"
print "(=) List of all sessions"
db.printSessions()
#---------------------------------------------------------------------------------------------------------#
#---------------------------------------------------------------------------------------------------------#
print "(========)NODE FUNCTION TESTS(========)"
#---------------------------------------------------------------------------------------------------------#