示例#1
0
 def setUpClass(cls):
     cls.image_json = \
         """
         {"image":
             {
                 "status": "ACTIVE",
                 "updated": "2012-06-29T17:38:26Z",
                 "links":
                     [{"href": "https://127.0.0.1/v2/600/images/1",
                       "rel": "self"},
                      {"href": "https://127.0.0.1/600/images/1",
                       "rel": "bookmark"},
                      {"href": "https://127.0.0.1/600/images/1",
                       "type": "application/vnd.openstack.image",
                       "rel": "alternate"}],
                 "minDisk": 10,
                 "id": "1",
                 "name": "Debian 6 (Squeeze)",
                 "created": "2012-06-29T17:38:07Z",
                 "OS-DCF:diskConfig": "AUTO",
                 "progress": 100,
                 "minRam": 256,
                 "metadata": {
                     "meta1": "value1",
                     "meta2": "value2"
                 }
             }
         }
         """
     cls.image = Image.deserialize(cls.image_json, 'json')
示例#2
0
 def setUpClass(cls):
     url = 'http://docs.openstack.org'
     cls.image_xml = \
         """
         <image
         xmlns:OS-DCF="{url}/compute/ext/disk_config/api/v1.1"
         xmlns:atom="http://www.w3.org/2005/Atom"
         xmlns="http://docs.openstack.org/compute/api/v1.1"
         status="ACTIVE" updated="2012-06-29T17:38:26Z"
         name="Debian 6 (Squeeze)"
         created="2012-06-29T17:38:07Z" minDisk="10" progress="100"
         minRam="256" id="1" OS-DCF:diskConfig="AUTO">
         <metadata>
             <meta key="meta1">value1</meta>
             <meta key="meta2">value2</meta>
         </metadata>
         <atom:link href="https://127.0.0.1/v2/600/images/1" rel="self"/>
         <atom:link href="https://127.0.0.1/600/images/1" rel="bookmark"/>
         <atom:link href="https://127.0.0.1/600/images/1"
         type="application/vnd.openstack.image" rel="alternate"/>
         </image>
         """.format(url=url)
     cls.image = Image.deserialize(cls.image_xml, 'xml')