Пример #1
0
	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(========)"
#---------------------------------------------------------------------------------------------------------#