#NEWLINE# @ mock_dynamodb #NEWLINE# def test_write_batch( ) : #NEWLINE# #INDENT# conn = boto . connect_dynamodb ( ) #NEWLINE# table = create_table ( conn ) #NEWLINE# batch_list = conn . new_batch_write_list ( ) #NEWLINE# items = [ ] #NEWLINE# items . append ( table . new_item ( hash_key = 'the-key' , attrs = { #NEWLINE# #INDENT# 'Body' : 'http://url_to_lolcat.gif' , #NEWLINE# 'SentBy' : 'User A' , #NEWLINE# 'ReceivedTime' : '12/9/2011 11:36:03 PM' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# items . append ( table . new_item ( hash_key = 'the-key2' , attrs = { #NEWLINE# #INDENT# 'Body' : 'http://url_to_lolcat.gif' , #NEWLINE# 'SentBy' : 'User B' , #NEWLINE# 'ReceivedTime' : '12/9/2011 11:36:03 PM' , #NEWLINE# 'Ids' : set ( [ 1 , 2 , 3 ] ) , #NEWLINE# 'PK' : 7 , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# batch_list . add_batch ( table , puts = conn ) #NEWLINE# conn . batch_write_item ( batch_list ) #NEWLINE# table . refresh ( ) #NEWLINE# table . item_count . should . equal ( 2 ) #NEWLINE# batch_list = conn . new_batch_write_list ( ) #NEWLINE# batch_list . add_batch ( table , deletes = [ 'the-key' ] ) #NEWLINE# conn . batch_write_item ( batch_list ) #NEWLINE# table . refresh ( ) #NEWLINE# table . item_count . should . equal ( 1 )