示例#1
0
    def test_create_image(self):
        test_image = image.Image(TEXT_XML_1)
        self.assertEqual(test_image.ID, "0")
        self.assertEqual(test_image.size, "40")
        self.assertEqual(test_image.datastore_ID, "1")

        test_image = image.Image(TEXT_XML_2)
        self.assertEqual(test_image.ID, "5")
        self.assertEqual(test_image.size, "5830")
        self.assertEqual(test_image.datastore_ID, "100")
示例#2
0
def test_create_image():
    test_image = image.Image(TEXT_XML_1)
    assert test_image.ID == "0"
    assert test_image.size == "40"
    assert test_image.datastore_ID == "1"

    test_image = image.Image(TEXT_XML_2)
    assert test_image.ID == "5"
    assert test_image.size == "5830"
    assert test_image.datastore_ID == "100"
示例#3
0
    def __init__(self, xml):
        root = ET.fromstring(xml)

        image_element = root.find("IMAGE")
        if image_element is not None:
            self._image = image.Image(ET.tostring(image_element))
        self._datastore = datastore.Datastore(
            ET.tostring(root.find("DATASTORE")))
示例#4
0
 def test_snap_delete(self):
     test_image = image.Image(SNAP_DELETE_XML)
     self.assertEqual(test_image.source, "OpenNebula-Image-233")
     self.assertEqual(test_image.target_snap, "0")
示例#5
0
def test_snap_delete():
    test_image = image.Image(SNAP_DELETE_XML)
    assert test_image.source == "OpenNebula-Image-233"
    assert test_image.target_snap == "0"