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


Python Environment.get_test_org方法代码示例

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


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

示例1: test_0030_download

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0030_download(self):
        """Test the method org.download_catalog_item().

        Download the two templates that were uploaded earlier.

        This test passes if the two download task writes non zero bytes to the
        disk without raising any exceptions.
        """
        org = Environment.get_test_org(TestCatalog._client)
        tempdir = None
        try:
            cwd = os.getcwd()
            tempdir = tempfile.mkdtemp(dir='.')
            os.chdir(tempdir)
            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_name,
                file_name=TestCatalog._test_template_file_name)
            self.assertNotEqual(bytes_written, 0)

            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_with_chunk_size_name,
                file_name=TestCatalog._test_template_with_chunk_size_file_name)
            self.assertNotEqual(bytes_written, 0)
        finally:
            if tempdir is not None:
                os.chdir(cwd)
                shutil.rmtree(tempdir)
开发者ID:vmware,项目名称:pyvcloud,代码行数:31,代码来源:catalog_tests.py

示例2: test_0070_update_catalog

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0070_update_catalog(self):
        """Test the method org.update_catalog().

        Update the name and description of the catalog created in
        test_0000_setup. Revert the changes madeto the catalog after we verify
        that the operation is successful.

        This test passes if the catalog updation operation succeeds without
        raising any errors.
        """
        logger = Environment.get_default_logger()
        org = Environment.get_test_org(TestCatalog._client)

        catalog_name = TestCatalog._test_catalog_name
        catalog_description = TestCatalog._test_catalog_description
        new_name = TestCatalog._test_catalog_updated_name
        new_description = TestCatalog._test_catalog_updated_description

        logger.debug('Changing catalog:' + catalog_name + ' \'name\' to ' +
                     new_name + ', and \'description\' to ' + new_description)
        updated_catalog_resource = org.update_catalog(catalog_name, new_name,
                                                      new_description)

        self.assertEqual(updated_catalog_resource.get('name'), new_name)
        self.assertEqual(updated_catalog_resource.Description.text,
                         new_description)

        logger.debug('Changing catalog:' + new_name + ' \'name\' back to ' +
                     catalog_name + ',and \'description\' back to ' +
                     catalog_description)
        org.reload()
        org.update_catalog(new_name, catalog_name, catalog_description)
开发者ID:vmware,项目名称:pyvcloud,代码行数:34,代码来源:catalog_tests.py

示例3: test_0020_get_vdc

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0020_get_vdc(self):
        """Test the method VDC.get_vdc().

        This test passes if the expected vdc can be successfully retrieved by
        name.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        vdc = org.get_vdc(TestOrgVDC._new_vdc_name)

        self.assertEqual(TestOrgVDC._new_vdc_name, vdc.get('name'))
        self.assertEqual(TestOrgVDC._new_vdc_href, vdc.get('href'))
开发者ID:vmware,项目名称:pyvcloud,代码行数:13,代码来源:vdc_tests.py

示例4: test_0030_get_non_existent_vdc

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0030_get_non_existent_vdc(self):
        """Test the method VDC.get_vdc().

        This test passes if the non-existent vdc can't be successfully
        retrieved by name.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        try:
            resource = org.get_vdc(TestOrgVDC._non_existent_vdc_name)
            self.assertIsNone(resource)
        except EntityNotFoundException as e:
            pass
开发者ID:vmware,项目名称:pyvcloud,代码行数:14,代码来源:vdc_tests.py

示例5: test_0050_get_catalog

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0050_get_catalog(self):
        """Test the method org.get_catalog().

        Retrieve the catalog created in test_0000_setup.

        This test passes if the catalog created in test_0000_setup is
        retrieved successfully without any errors.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_resource = org.get_catalog(TestCatalog._test_catalog_name)

        self.assertEqual(TestCatalog._test_catalog_name,
                         catalog_resource.get('name'))
开发者ID:vmware,项目名称:pyvcloud,代码行数:15,代码来源:catalog_tests.py

示例6: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
 def test_0000_setup(self):
     TestCaCertificates._client = Environment.get_sys_admin_client()
     TestCaCertificates._config = Environment.get_config()
     TestCaCertificates._org = Environment.get_test_org(
         TestCaCertificates._client)
     test_gateway = Environment.get_test_gateway(TestCaCertificates._client)
     gateway_obj1 = Gateway(TestCaCertificates._client, GatewayConstants.name,
                            href=test_gateway.get('href'))
     TestCaCertificates.gateway_obj = gateway_obj1
     TestCaCertificates._runner = CliRunner()
     default_org = self._config['vcd']['default_org_name']
     self._login()
     TestCaCertificates._runner.invoke(org, ['use', default_org])
开发者ID:vmware,项目名称:vca-cli,代码行数:15,代码来源:ca_certificate_tests.py

示例7: _0130_catalog_sharing_via_acl

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def _0130_catalog_sharing_via_acl(self):
        org = Environment.get_test_org(TestCatalog._client)
        catalog_name = TestCatalog._test_catalog_name

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
        # TODO(): Access the catalog using a vapp_user user

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
开发者ID:vmware,项目名称:pyvcloud,代码行数:16,代码来源:catalog_tests.py

示例8: test_0060_get_nonexistent_catalog

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0060_get_nonexistent_catalog(self):
        """Test the method org.get_catalog() for a non existent catalog.

        This test passes if the catalog retrieval operation fails with a
        EntityNotFoundException.
        """
        org = Environment.get_test_org(TestCatalog._client)
        try:
            org.get_catalog(TestCatalog._non_existent_catalog_name)
            self.fail('Should not be able to fetch catalog ' +
                      TestCatalog._non_existent_catalog_name)
        except EntityNotFoundException as e:
            return
        self.fail('Should fail with EntityNotFoundException while fetching'
                  'catalog ' + TestCatalog._non_existent_catalog_name)
开发者ID:vmware,项目名称:pyvcloud,代码行数:17,代码来源:catalog_tests.py

示例9: test_0040_list_catalog

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0040_list_catalog(self):
        """Test the method org.list_catalog().

        Fetches all catalogs in the current organization.

        This test passes if the catalog created in test_0000_setup is present
        in the retrieved list of catalogs.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_list = org.list_catalogs()

        retieved_catalog_names = []
        for catalog in catalog_list:
            retieved_catalog_names.append(catalog.get('name'))

        self.assertIn(TestCatalog._test_catalog_name, retieved_catalog_names)
开发者ID:vmware,项目名称:pyvcloud,代码行数:18,代码来源:catalog_tests.py

示例10: test_0010_list_vdc

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0010_list_vdc(self):
        """Test the method VDC.list_vdcs().

        This test passes if the vdc created during setup can be found in the
        list of vdcs retrieved.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        vdc_list = org.list_vdcs()

        retrieved_vdc_names = []
        retrieved_vdc_hrefs = []
        for vdc in vdc_list:
            retrieved_vdc_names.append(vdc['name'])
            retrieved_vdc_hrefs.append(vdc['href'])

        self.assertIn(TestOrgVDC._new_vdc_name, retrieved_vdc_names)
        self.assertIn(TestOrgVDC._new_vdc_href, retrieved_vdc_hrefs)
开发者ID:vmware,项目名称:pyvcloud,代码行数:19,代码来源:vdc_tests.py

示例11: test_0100_get_catalog_item

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0100_get_catalog_item(self):
        """Test the method org.get_catalog_item().

        Retrieve the first template uploaded to the catalog created in setup
        method.

        This test depends on the success of test_0010_upload_tempalte.

        This test passes if the first uploaded templates is retrieved
        successfully.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_item_resource = org.get_catalog_item(
            TestCatalog._test_catalog_name, TestCatalog._test_template_name)

        self.assertEqual(TestCatalog._test_template_name,
                         catalog_item_resource.get('name'))
开发者ID:vmware,项目名称:pyvcloud,代码行数:19,代码来源:catalog_tests.py

示例12: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """
        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._logger = Environment.get_default_logger()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
        test_gateway = Environment.get_test_gateway(TestIpSecVpn._client)
        gateway_obj1 = Gateway(TestIpSecVpn._client, GatewayConstants.name,
                               href=test_gateway.get('href'))
        gateway_obj2 = TestIpSecVpn._gateway_obj
        TestIpSecVpn._local_ip = self.__get_ip_address(
            gateway=gateway_obj1, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._peer_ip = self.__get_ip_address(
            gateway=gateway_obj2, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        self._login()
        TestIpSecVpn._runner.invoke(org, ['use', default_org])
        result = TestIpSecVpn._runner.invoke(
            gateway,
            args=[
                'services', 'ipsec-vpn', 'create', TestIpSecVpn._name,
                '--name', TestIpSecVpn._ipsec_vpn_name,
                '--local-id', TestIpSecVpn._local_id,
                '--peer-id', TestIpSecVpn._peer_id,
                '--local-ip', TestIpSecVpn._local_ip,
                '--peer-ip', TestIpSecVpn._peer_ip,
                '--local-subnet', TestIpSecVpn._local_subnet,
                '--peer-subnet', TestIpSecVpn._peer_subnet,
                '--pre-shared-key', TestIpSecVpn._psk, '--enable'])
        self.assertEqual(0, result.exit_code)
开发者ID:vmware,项目名称:vca-cli,代码行数:45,代码来源:ipsec_vpn_tests.py

示例13: test_cleanup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_cleanup(self):
        """Get the test Org and delete it."""
        client = None
        try:
            logger = Environment.get_default_logger()
            client = Environment.get_sys_admin_client()
            test_org = Environment.get_test_org(client)

            logger.debug('Deleting test org: {0}'.format(test_org.get_name()))
            sys_admin_resource = client.get_admin()
            system = System(client, admin_resource=sys_admin_resource)
            task = system.delete_org(test_org.get_name(), True, True)

            # Track the task to completion.
            result = client.get_task_monitor().wait_for_success(task)
            self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
        finally:
            if client is not None:
                client.logout()
开发者ID:vmware,项目名称:pyvcloud,代码行数:21,代码来源:cleanup_test.py

示例14: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0000_setup(self):
        """Setup the org vdc required for the other tests in this module.

        Create one org vdc as per the configuration stated above. Test the
        method Org.create_org_vdc().

        This test passes if the vdc href is not None.
        """
        logger = Environment.get_default_logger()
        TestOrgVDC._client = Environment.get_sys_admin_client()
        org = Environment.get_test_org(TestOrgVDC._client)

        vdc_name = TestOrgVDC._new_vdc_name
        pvdc_name = Environment.get_test_pvdc_name()
        storage_profiles = [{
            'name': '*',
            'enabled': True,
            'units': 'MB',
            'limit': 0,
            'default': True
        }]

        vdc_resource = org.create_org_vdc(
            vdc_name,
            pvdc_name,
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        TestOrgVDC._client.get_task_monitor().wait_for_success(
            task=vdc_resource.Tasks.Task[0])

        logger.debug('Created ovdc ' + vdc_name + '.')

        # The following contraption is required to get the non admin href of
        # the ovdc. vdc_resource contains the admin version of the href since
        # we created the ovdc as a sys admin.
        org.reload()
        for vdc in org.list_vdcs():
            if vdc.get('name').lower() == vdc_name.lower():
                TestOrgVDC._new_vdc_href = vdc.get('href')

        self.assertIsNotNone(TestOrgVDC._new_vdc_href)
开发者ID:vmware,项目名称:pyvcloud,代码行数:44,代码来源:vdc_tests.py

示例15: test_0010_upload_template

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_org [as 别名]
    def test_0010_upload_template(self):
        """Test the method org.upload_ovf().

        Upload an ova template to catalog. The template doesn't have
        ovf:chunkSize param in it's descriptor(ovf file).

        This test passes if the upload succeeds and no exceptions are raised.
        """
        org = Environment.get_test_org(TestCatalog._client)

        self._template_upload_helper(
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name,
            template_file_name=TestCatalog._test_template_file_name)
        self._template_import_monitor(
            client=TestCatalog._client,
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name)
开发者ID:vmware,项目名称:pyvcloud,代码行数:22,代码来源:catalog_tests.py


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