#NEWLINE# def _run( self , params ) : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'mongodb-insert' ) : #NEWLINE# #INDENT# return connections . mongodb_jobs . tests_inserts . insert ( { #NEWLINE# #INDENT# 'params' : params [ 'params' ] , #NEWLINE# #UNINDENT# } , manipulate = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'mongodb-find' ) : #NEWLINE# #INDENT# cursor = connections . mongodb_jobs . tests_inserts . find ( { #NEWLINE# #INDENT# 'test' : 'x' , #NEWLINE# #UNINDENT# } ) #NEWLINE# return list ( cursor ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'mongodb-count' ) : #NEWLINE# #INDENT# return connections . mongodb_jobs . tests_inserts . count ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'mongodb-full-getmore' ) : #NEWLINE# #INDENT# connections . mongodb_jobs . tests_inserts . insert_many ( [ { #NEWLINE# #INDENT# 'a' : 1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'a' : 2 , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# return list ( connections . mongodb_jobs . tests_inserts . find ( batch_size = 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'redis-llen' ) : #NEWLINE# #INDENT# return connections . redis . llen ( params [ 'params' ] [ 'key' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'redis-lpush' ) : #NEWLINE# #INDENT# return connections . redis . lpush ( params [ 'params' ] [ 'key' ] , 'xxx' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'urllib2-get' ) : #NEWLINE# #INDENT# fp = urllib2 . urlopen ( params [ 'params' ] [ 'url' ] ) #NEWLINE# return fp . read ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'urllib2-post' ) : #NEWLINE# #INDENT# return urllib2 . urlopen ( params [ 'params' ] [ 'url' ] , data = 'x=x' ) . read ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'test' ] == 'requests-get' ) : #NEWLINE# #INDENT# import requests #NEWLINE# return requests . get ( params [ 'params' ] [ 'url' ] , verify = False ) . text