Пример #1
0
	def update(self):
		db = DBManager()
		sessionData = db.getSession(self.phrase)
		db.close()
		self.setLocals(sessionData)		
Пример #2
0
	try:
		db.createSession(ses)
	except SessionError as se:
		print "\t(-) Failed to create session! Already Exists"
	print "\t(+) Session created!"
#---------------------------------------------------------------------------------------------------------#	
	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"