#NEWLINE# @ mock_dynamodb #NEWLINE# def test_scan( ) : #NEWLINE# #INDENT# conn = boto . connect_dynamodb ( ) #NEWLINE# table = create_table ( conn ) #NEWLINE# item_data = { #NEWLINE# #INDENT# 'Body' : 'http://url_to_lolcat.gif' , #NEWLINE# 'SentBy' : 'User A' , #NEWLINE# 'ReceivedTime' : '12/9/2011 11:36:03 PM' , #NEWLINE# #UNINDENT# } #NEWLINE# item = table . new_item ( hash_key = 'the-key' , attrs = conn ) #NEWLINE# item . put ( ) #NEWLINE# item = table . new_item ( hash_key = 'the-key2' , attrs = item_data ) #NEWLINE# item . put ( ) #NEWLINE# item_data = { #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# item = table . new_item ( hash_key = 'the-key3' , attrs = item_data ) #NEWLINE# item . put ( ) #NEWLINE# results = table . scan ( ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 3 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'SentBy' : condition . EQ ( 'User B' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 1 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'Body' : condition . BEGINS_WITH ( 'http' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 3 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'Ids' : condition . CONTAINS ( 2 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 1 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'Ids' : condition . NOT_NULL ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 1 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'Ids' : condition . NULL ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 2 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'PK' : condition . BETWEEN ( 8 , 9 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 0 ) #NEWLINE# results = table . scan ( scan_filter = { #NEWLINE# #INDENT# 'PK' : condition . BETWEEN ( 5 , 8 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results . response [ 'Items' ] . should . have . length_of ( 1 )