當前位置: 首頁>>代碼示例>>Python>>正文


Python Iso.delete方法代碼示例

本文整理匯總了Python中marvin.lib.base.Iso.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python Iso.delete方法的具體用法?Python Iso.delete怎麽用?Python Iso.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在marvin.lib.base.Iso的用法示例。


在下文中一共展示了Iso.delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_01_list_isos_pagination

# 需要導入模塊: from marvin.lib.base import Iso [as 別名]
# 或者: from marvin.lib.base.Iso import delete [as 別名]

#.........這裏部分代碼省略.........
        status = validateList(list_iso_after)
        self.assertEquals(
                          PASS,
                          status[0],
                          "ISO's creation failed"
                          )
        # Verifying that list size is pagesize + 1
        self.assertEquals(
                          self.services["pagesize"] + 1,
                          len(list_iso_after),
                          "Failed to create pagesize + 1 number of ISO's"
                          )
        # Listing all the ISO's in page 1
        list_iso_page1 = Iso.list(
                                  self.userapiclient,
                                  listall=self.services["listall"],
                                  isofilter=self.services["templatefilter"],
                                  page=1,
                                  pagesize=self.services["pagesize"]
                                  )
        status = validateList(list_iso_page1)
        self.assertEquals(
                          PASS,
                          status[0],
                          "Failed to list ISO's in page 1"
                          )
        # Verifying the list size to be equal to pagesize
        self.assertEquals(
                          self.services["pagesize"],
                          len(list_iso_page1),
                          "Size of ISO's in page 1 is not matching"
                          )
        # Listing all the Templates in page 2
        list_iso_page2 = Iso.list(
                                  self.userapiclient,
                                  listall=self.services["listall"],
                                  isofilter=self.services["templatefilter"],
                                  page=2,
                                  pagesize=self.services["pagesize"]
                                  )
        status = validateList(list_iso_page2)
        self.assertEquals(
                          PASS,
                          status[0],
                          "Failed to list ISo's in page 2"
                          )
        # Verifying the list size to be equal to 1
        self.assertEquals(
                          1,
                          len(list_iso_page2),
                          "Size of ISO's in page 2 is not matching"
                          )
        # Verifying the state of the ISO to be ready. If not waiting for state to become ready
        iso_ready = False
        count = 0
        while iso_ready is False:
            list_iso = Iso.list(
                                self.userapiclient,
                                listall=self.services["listall"],
                                isofilter=self.services["templatefilter"],
                                id=iso_created.id
                                )
            status = validateList(list_iso)
            self.assertEquals(
                              PASS,
                              status[0],
                              "Failed to list ISO by Id"
                              )
            if list_iso[0].isready is True:
                iso_ready = True
            elif (str(list_iso[0].status) == "Error"):
                self.fail("Created ISO is in Errored state")
                break
            elif count > 10:
                self.fail("Timed out before ISO came into ready state")
                break
            else:
                time.sleep(self.services["sleep"])
                count = count + 1

        # Deleting the ISO present in page 2
        Iso.delete(
                   iso_created,
                   self.userapiclient
                   )
        # Listing all the ISO's in page 2 again
        list_iso_page2 = Iso.list(
                                  self.userapiclient,
                                  listall=self.services["listall"],
                                  isofilter=self.services["templatefilter"],
                                  page=2,
                                  pagesize=self.services["pagesize"]
                                  )
        # Verifying that there are no ISO's listed
        self.assertIsNone(
                          list_iso_page2,
                          "ISO's not deleted from page 2"
                          )
        del self.services["iso"]["zoneid"]
        return
開發者ID:fengyueyugu,項目名稱:cloudstack,代碼行數:104,代碼來源:test_escalations_isos.py


注:本文中的marvin.lib.base.Iso.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。