#NEWLINE# def test_show_no_server( self ) : #NEWLINE# #INDENT# serializer = images . ImageXMLSerializer ( ) #NEWLINE# fixture = { #NEWLINE# #INDENT# 'image' : { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'name' : 'Image1' , #NEWLINE# 'created' : self . TIMESTAMP , #NEWLINE# 'updated' : self . TIMESTAMP , #NEWLINE# 'status' : 'ACTIVE' , #NEWLINE# 'metadata' : { #NEWLINE# #INDENT# 'key1' : 'value1' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'links' : [ { #NEWLINE# #INDENT# 'href' : ( self . IMAGE_HREF % 1 ) , #NEWLINE# 'rel' : 'self' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'href' : ( self . IMAGE_BOOKMARK % 1 ) , #NEWLINE# 'rel' : 'bookmark' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# output = serializer . serialize ( fixture , 'show' ) #NEWLINE# actual = minidom . parseString ( output . replace ( '  ' , '' ) ) #NEWLINE# expected_href = ( self . IMAGE_HREF % 1 ) #NEWLINE# expected_bookmark = ( self . IMAGE_BOOKMARK % 1 ) #NEWLINE# expected_now = self . TIMESTAMP #NEWLINE# expected = minidom . parseString ( ( '\n        <image id="1"\n                xmlns="http://docs.openstack.org/compute/api/v1.1"\n                xmlns:atom="http://www.w3.org/2005/Atom"\n                name="Image1"\n                updated="%(expected_now)s"\n                created="%(expected_now)s"\n                status="ACTIVE">\n            <metadata>\n                <meta key="key1">\n                    value1\n                </meta>\n            </metadata>\n            <atom:link href="%(expected_href)s" rel="self"/>\n            <atom:link href="%(expected_bookmark)s" rel="bookmark"/>\n        </image>\n        ' . replace ( '  ' , '' ) % locals ( ) ) ) #NEWLINE# self . assertEqual ( expected . toxml ( ) , actual . toxml ( ) )