<s> import tornado . ioloop <EOL> import time <EOL> import logging <EOL> import test_shunt <EOL> import asyncmongo <EOL> TEST_TIMESTAMP = int ( time . time ( ) ) <EOL> class InsertDeleteTest ( test_shunt . MongoTest ) : <EOL> def test_insert ( self ) : <EOL> test_shunt . setup ( ) <EOL> db = asyncmongo . Client ( pool_id = '<STR_LIT>' , host = '<STR_LIT:127.0.0.1>' , port = <NUM_LIT> , dbname = '<STR_LIT:test>' ) <EOL> def insert_callback ( response , error ) : <EOL> tornado . ioloop . IOLoop . instance ( ) . stop ( ) <EOL> logging . info ( response ) <EOL> assert len ( response ) == <NUM_LIT:1> <EOL> test_shunt . register_called ( '<STR_LIT>' ) <EOL> db . test_users . insert ( { "<STR_LIT>" : "<STR_LIT>" % TEST_TIMESTAMP } , callback = insert_callback ) <EOL> tornado . ioloop . IOLoop . instance ( ) . start ( ) <EOL> test_shunt . assert_called ( '<STR_LIT>' ) <EOL> def query_callback ( response , error ) : <EOL> tornado . ioloop . IOLoop . instance ( ) . stop ( ) <EOL> logging . info ( response ) <EOL> assert len ( response ) == <NUM_LIT:1> <EOL> test_shunt . register_called ( '<STR_LIT>' ) <EOL> db . test_users . find_one ( { "<STR_LIT>" : "<STR_LIT>" % TEST_TIMESTAMP } , callback = query_callback ) <EOL> tornado . ioloop . IOLoop . instance ( ) . start ( ) <EOL> test_shunt . assert_called ( '<STR_LIT>' ) <EOL> def delete_callback ( response , error ) : <EOL> tornado . ioloop . IOLoop . instance ( ) . stop ( ) <EOL> logging . info ( response ) <EOL> assert len ( response ) == <NUM_LIT:1> <EOL> test_shunt . register_called ( '<STR_LIT>' ) <EOL> db . test_users . remove ( { "<STR_LIT>" : "<STR_LIT>" % TEST_TIMESTAMP } , callback = delete_callback ) <EOL> tornado . ioloop . IOLoop . instance ( ) . start ( ) <EOL> test_shunt . assert_called ( '<STR_LIT>' ) </s>
