#NEWLINE# def test_serialize( self ) : #NEWLINE# #INDENT# metadata = { #NEWLINE# #INDENT# 'name' : 'image1' , #NEWLINE# 'is_public' : True , #NEWLINE# 'foo' : 'bar' , #NEWLINE# 'properties' : { #NEWLINE# #INDENT# 'prop1' : 'propvalue1' , #NEWLINE# 'mappings' : [ { #NEWLINE# #INDENT# 'virtual' : 'aaa' , #NEWLINE# 'device' : 'bbb' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'virtual' : 'xxx' , #NEWLINE# 'device' : 'yyy' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'block_device_mapping' : [ { #NEWLINE# #INDENT# 'virtual_device' : 'fake' , #NEWLINE# 'device_name' : '/dev/fake' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'virtual_device' : 'ephemeral0' , #NEWLINE# 'device_name' : '/dev/fake0' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# converted = glance . _convert_to_string ( metadata ) #NEWLINE# self . assertEqual ( glance . _convert_from_string ( converted ) , metadata )