当前位置: 首页>>代码示例>>Python>>正文


Python VCA.delete_catalog方法代码示例

本文整理汇总了Python中pyvcloud.vcloudair.VCA.delete_catalog方法的典型用法代码示例。如果您正苦于以下问题:Python VCA.delete_catalog方法的具体用法?Python VCA.delete_catalog怎么用?Python VCA.delete_catalog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.vcloudair.VCA的用法示例。


在下文中一共展示了VCA.delete_catalog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import delete_catalog [as 别名]

#.........这里部分代码省略.........
            result = self.vca.login(token=self.vca.token)
            assert result
            result = self.vca.login_to_org(service, org)
            assert result
        elif vcloudair.VCA_SERVICE_TYPE_ONDEMAND == service_type:
            result = self.vca.login(password=password)
            assert result
            result = self.vca.login_to_instance(password=password, instance=instance, token=None, org_url=None)
            assert result
            result = self.vca.login_to_instance(password=None, instance=instance, token=self.vca.vcloud_session.token, org_url=self.vca.vcloud_session.org_url)
            assert result


    def logout_from_vcloud(self):
        """Logout from vCloud"""
        print 'logout'
        selfl.vca.logout()
        self.vca = None
        assert self.vca is None


    def catalog_exists(self, catalog_name, catalogs):
        for catalog in catalogs:
            if catalog.name == catalog_name:
                return True
        return False


    def test_0001(self):
        """Loggin in to vCloud"""
        assert self.vca.token


    def test_0002(self):
        """Get VDC"""
        vdc_name = config['vcloud']['vdc']
        the_vdc = self.vca.get_vdc(vdc_name)        
        assert the_vdc
        assert the_vdc.get_name() == vdc_name


    def test_0009(self):
        """Validate that catalog doesn't exist"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        custom_catalog = config['vcloud']['custom_catalog']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        catalogs = self.vca.get_catalogs()
        assert not self.catalog_exists(custom_catalog, catalogs)


    def test_0010(self):
        """Create Catalog"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        custom_catalog = config['vcloud']['custom_catalog']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        task = self.vca.create_catalog(custom_catalog, custom_catalog)
        assert task
        result = self.vca.block_until_completed(task)
        assert result
        catalogs = self.vca.get_catalogs()
        assert self.catalog_exists(custom_catalog, catalogs)


    def test_0011(self):
        """Upload media file"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        custom_catalog = config['vcloud']['custom_catalog']
        media_file_name = config['vcloud']['media_file_name']
        media_name = config['vcloud']['media_name']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        result = self.vca.upload_media(custom_catalog, media_name, media_file_name, media_file_name, True)
        assert result
        #todo: assert that media is uploaded

    def test_0099(self):
        """Delete Catalog"""
        vdc_name = config['vcloud']['vdc']
        vapp_name = config['vcloud']['vapp']
        vm_name = config['vcloud']['vm']
        custom_catalog = config['vcloud']['custom_catalog']
        the_vdc = self.vca.get_vdc(vdc_name)
        assert the_vdc
        assert the_vdc.get_name() == vdc_name
        deleted = self.vca.delete_catalog(custom_catalog)
        assert deleted
        the_vdc = self.vca.get_vdc(vdc_name)
        catalogs = self.vca.get_catalogs()
        assert not self.catalog_exists(custom_catalog, catalogs)
开发者ID:digideskio,项目名称:pyvcloud,代码行数:104,代码来源:catalog_tests.py


注:本文中的pyvcloud.vcloudair.VCA.delete_catalog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。