#NEWLINE# @ requires_boto_gte ( '2.28' ) #NEWLINE# @ mock_sqs #NEWLINE# def test_send_message_with_attributes( ) : #NEWLINE# #INDENT# conn = boto . connect_sqs ( 'the_key' , 'the_secret' ) #NEWLINE# queue = conn . create_queue ( 'test-queue' , visibility_timeout = 60 ) #NEWLINE# queue . set_message_class ( RawMessage ) #NEWLINE# body = 'this is a test message' #NEWLINE# message = queue . new_message ( body ) #NEWLINE# message_attributes = { #NEWLINE# #INDENT# 'test.attribute_name' : { #NEWLINE# #INDENT# 'data_type' : 'String' , #NEWLINE# 'string_value' : 'attribute value' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'test.binary_attribute' : { #NEWLINE# #INDENT# 'data_type' : 'Binary' , #NEWLINE# 'binary_value' : 'binary value' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'test.number_attribute' : { #NEWLINE# #INDENT# 'data_type' : 'Number' , #NEWLINE# 'string_value' : 'string value' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# message . message_attributes = message_attributes #NEWLINE# queue . write ( message ) #NEWLINE# messages = conn . receive_message ( queue ) #NEWLINE# messages [ 0 ] . get_body ( ) . should . equal ( body ) #NEWLINE# for ( name , value ) in message_attributes . items ( ) : #NEWLINE# #INDENT# dict ( messages [ 0 ] . message_attributes [ name ] ) . should . equal ( value )