• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python data_utils.rand_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tempest.common.utils.data_utils.rand_name函数的典型用法代码示例。如果您正苦于以下问题:Python rand_name函数的具体用法?Python rand_name怎么用?Python rand_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_copy_object_across_containers

    def test_copy_object_across_containers(self):
        # create a container to use as  asource container
        src_container_name = data_utils.rand_name(name="TestSourceContainer")
        self.container_client.create_container(src_container_name)
        self.containers.append(src_container_name)
        # create a container to use as a destination container
        dst_container_name = data_utils.rand_name(name="TestDestinationContainer")
        self.container_client.create_container(dst_container_name)
        self.containers.append(dst_container_name)
        # create object in source container
        object_name = data_utils.rand_name(name="Object")
        data = data_utils.arbitrary_string(size=len(object_name) * 2, base_text=object_name)
        resp, _ = self.object_client.create_object(src_container_name, object_name, data)
        # set object metadata
        meta_key = data_utils.rand_name(name="test-")
        meta_value = data_utils.rand_name(name="MetaValue-")
        orig_metadata = {meta_key: meta_value}
        resp, _ = self.object_client.update_object_metadata(src_container_name, object_name, orig_metadata)
        self.assertIn(int(resp["status"]), HTTP_SUCCESS)
        self.assertHeaders(resp, "Object", "POST")

        # copy object from source container to destination container
        resp, _ = self.object_client.copy_object_across_containers(
            src_container_name, object_name, dst_container_name, object_name
        )
        self.assertEqual(resp["status"], "201")
        self.assertHeaders(resp, "Object", "PUT")

        # check if object is present in destination container
        resp, body = self.object_client.get_object(dst_container_name, object_name)
        self.assertEqual(body, data)
        actual_meta_key = "x-object-meta-" + meta_key
        self.assertIn(actual_meta_key, resp)
        self.assertEqual(resp[actual_meta_key], meta_value)
开发者ID:Grindizer,项目名称:tempest,代码行数:34,代码来源:test_object_services.py


示例2: test_aggregate_create_update_with_az

    def test_aggregate_create_update_with_az(self):
        # Update an aggregate and ensure properties are updated correctly
        self.useFixture(fixtures.LockFixture('availability_zone'))
        aggregate_name = rand_name(self.aggregate_name_prefix)
        az_name = rand_name(self.az_name_prefix)
        resp, aggregate = self.client.create_aggregate(aggregate_name, az_name)
        self.addCleanup(self.client.delete_aggregate, aggregate['id'])

        self.assertEqual(200, resp.status)
        self.assertEqual(aggregate_name, aggregate['name'])
        self.assertEqual(az_name, aggregate['availability_zone'])
        self.assertIsNotNone(aggregate['id'])

        aggregate_id = aggregate['id']
        new_aggregate_name = aggregate_name + '_new'
        new_az_name = az_name + '_new'

        resp, resp_aggregate = self.client.update_aggregate(aggregate_id,
                                                            new_aggregate_name,
                                                            new_az_name)
        self.assertEqual(200, resp.status)
        self.assertEqual(new_aggregate_name, resp_aggregate['name'])
        self.assertEqual(new_az_name, resp_aggregate['availability_zone'])

        resp, aggregates = self.client.list_aggregates()
        self.assertEqual(200, resp.status)
        self.assertIn((aggregate_id, new_aggregate_name, new_az_name),
                      map(lambda x:
                         (x['id'], x['name'], x['availability_zone']),
                          aggregates))
开发者ID:sc68cal,项目名称:tempest,代码行数:30,代码来源:test_aggregates.py


示例3: test_create_update_delete_domain

    def test_create_update_delete_domain(self):
        d_name = data_utils.rand_name('domain-')
        d_desc = data_utils.rand_name('domain-desc-')
        domain = self.client.create_domain(
            d_name, description=d_desc)
        self.addCleanup(self._delete_domain, domain['id'])
        self.assertIn('id', domain)
        self.assertIn('description', domain)
        self.assertIn('name', domain)
        self.assertIn('enabled', domain)
        self.assertIn('links', domain)
        self.assertIsNotNone(domain['id'])
        self.assertEqual(d_name, domain['name'])
        self.assertEqual(d_desc, domain['description'])
        self.assertEqual(True, domain['enabled'])
        new_desc = data_utils.rand_name('new-desc-')
        new_name = data_utils.rand_name('new-name-')

        updated_domain = self.client.update_domain(
            domain['id'], name=new_name, description=new_desc)
        self.assertIn('id', updated_domain)
        self.assertIn('description', updated_domain)
        self.assertIn('name', updated_domain)
        self.assertIn('enabled', updated_domain)
        self.assertIn('links', updated_domain)
        self.assertIsNotNone(updated_domain['id'])
        self.assertEqual(new_name, updated_domain['name'])
        self.assertEqual(new_desc, updated_domain['description'])
        self.assertEqual('true', str(updated_domain['enabled']).lower())

        fetched_domain = self.client.get_domain(domain['id'])
        self.assertEqual(new_name, fetched_domain['name'])
        self.assertEqual(new_desc, fetched_domain['description'])
        self.assertEqual('true', str(fetched_domain['enabled']).lower())
开发者ID:midokura,项目名称:tempest,代码行数:34,代码来源:test_domains.py


示例4: test_project_create_with_parent

    def test_project_create_with_parent(self):
        # Create root project without providing a parent_id
        self.data.setup_test_domain()
        domain_id = self.data.domain['id']

        root_project_name = data_utils.rand_name('root_project')
        root_project = self.projects_client.create_project(
            root_project_name, domain_id=domain_id)['project']
        self.addCleanup(
            self.projects_client.delete_project, root_project['id'])

        root_project_id = root_project['id']
        parent_id = root_project['parent_id']
        self.assertEqual(root_project_name, root_project['name'])
        # If not provided, the parent_id must point to the top level
        # project in the hierarchy, i.e. its domain
        self.assertEqual(domain_id, parent_id)

        # Create a project using root_project_id as parent_id
        project_name = data_utils.rand_name('project')
        project = self.projects_client.create_project(
            project_name, domain_id=domain_id,
            parent_id=root_project_id)['project']
        self.addCleanup(self.projects_client.delete_project, project['id'])
        parent_id = project['parent_id']
        self.assertEqual(project_name, project['name'])
        self.assertEqual(root_project_id, parent_id)
开发者ID:WoolenWang,项目名称:tempest,代码行数:27,代码来源:test_projects.py


示例5: test_create_delete_token

 def test_create_delete_token(self):
     # get a token by username and password
     user_name = data_utils.rand_name(name='user-')
     user_password = data_utils.rand_name(name='pass-')
     # first:create a tenant
     tenant_name = data_utils.rand_name(name='tenant-')
     resp, tenant = self.client.create_tenant(tenant_name)
     self.assertEqual(200, resp.status)
     self.data.tenants.append(tenant)
     # second:create a user
     resp, user = self.client.create_user(user_name, user_password,
                                          tenant['id'], '')
     self.assertEqual(200, resp.status)
     self.data.users.append(user)
     # then get a token for the user
     rsp, body = self.token_client.auth(user_name,
                                        user_password,
                                        tenant['name'])
     access_data = json.loads(body)['access']
     self.assertEqual(rsp['status'], '200')
     self.assertEqual(access_data['token']['tenant']['name'],
                      tenant['name'])
     # then delete the token
     token_id = access_data['token']['id']
     resp, body = self.client.delete_token(token_id)
     self.assertEqual(resp['status'], '204')
开发者ID:DmitryIakunchikov,项目名称:tempest,代码行数:26,代码来源:test_tokens.py


示例6: test_create_update_get_delete_record

 def test_create_update_get_delete_record(self):
     # Create Domain
     name = data_utils.rand_name('domain') + '.com.'
     email = data_utils.rand_name('dns') + '@testmail.com'
     _, domain = self.dns_domains_client.create_domain(name, email)
     self.addCleanup(self.dns_domains_client.delete_domain, domain['id'])
     # Create Record
     r_name = 'www.' + name
     r_data = "192.0.2.4"
     _, record = self.client.create_record(domain_id=domain['id'],
                                           name=r_name, data=r_data,
                                           type='A')
     self.addCleanup(self._delete_record, domain['id'], record['id'])
     self.assertIsNotNone(record['id'])
     self.assertEqual(domain['id'], record['domain_id'])
     self.assertEqual(r_name, record['name'])
     self.assertEqual(r_data, record['data'])
     self.assertEqual('A', record['type'])
     # Update Record with data and ttl
     r_data1 = "192.0.2.5"
     r_ttl = 3600
     _, update_record = self.client.update_record(domain_id=domain['id'],
                                                  record_id=record['id'],
                                                  name=r_name, type='A',
                                                  data=r_data1, ttl=r_ttl)
     self.assertEqual(r_data1, update_record['data'])
     self.assertEqual(r_ttl, update_record['ttl'])
     # GET record
     _, get_record = self.client.get_record(domain_id=domain['id'],
                                            record_id=record['id'])
     self.assertEqual(update_record['data'], get_record['data'])
     self.assertEqual(update_record['name'], get_record['name'])
     self.assertEqual(update_record['type'], get_record['type'])
     self.assertEqual(update_record['ttl'], get_record['ttl'])
     self.assertEqual(update_record['domain_id'], get_record['domain_id'])
开发者ID:AnatolyZimin,项目名称:designate,代码行数:35,代码来源:test_records.py


示例7: test_get_updated_quotas

    def test_get_updated_quotas(self):
        # Verify that GET shows the updated quota set of project
        project_name = data_utils.rand_name('cpu_quota_project')
        project_desc = project_name + '-desc'
        project = self.identity_utils.create_project(name=project_name,
                                                     description=project_desc)
        project_id = project['id']
        self.addCleanup(self.identity_utils.delete_project, project_id)

        self.adm_client.update_quota_set(project_id, ram='5120')
        quota_set = self.adm_client.show_quota_set(project_id)['quota_set']
        self.assertEqual(5120, quota_set['ram'])

        # Verify that GET shows the updated quota set of user
        user_name = data_utils.rand_name('cpu_quota_user')
        password = data_utils.rand_name('password')
        email = user_name + '@testmail.tm'
        user = self.identity_utils.create_user(username=user_name,
                                               password=password,
                                               project=project,
                                               email=email)
        if 'user' in user:
            user = user['user']
        user_id = user['id']
        self.addCleanup(self.identity_utils.delete_user, user_id)

        self.adm_client.update_quota_set(project_id,
                                         user_id=user_id,
                                         ram='2048')
        quota_set = self.adm_client.show_quota_set(
            project_id, user_id=user_id)['quota_set']
        self.assertEqual(2048, quota_set['ram'])
开发者ID:jishandong,项目名称:tempest,代码行数:32,代码来源:test_quotas.py


示例8: test_list_alarm_definitions_with_severity

    def test_list_alarm_definitions_with_severity(self):
        name = data_utils.rand_name('alarm_definition')
        expression = 'avg(cpu_utilization) >= 1000'
        alarm_definition = helpers.create_alarm_definition(
            name=name,
            description="description",
            expression=expression,
            severity="LOW")
        resp, res_body_create_alarm_def = self.monasca_client.\
            create_alarm_definitions(alarm_definition)
        self.assertEqual(201, resp.status)

        name = data_utils.rand_name('alarm_definition')
        expression = 'avg(cpu_utilization) >= 1000'
        alarm_definition = helpers.create_alarm_definition(
            name=name,
            description="description",
            expression=expression,
            severity="MEDIUM")
        resp, res_body_create_alarm_def = self.monasca_client.\
            create_alarm_definitions(alarm_definition)
        self.assertEqual(201, resp.status)

        query_param = '?severity=MEDIUM'
        resp, response_body = self.monasca_client.\
            list_alarm_definitions(query_param)
        self._verify_list_alarm_definitions_response_body(resp, response_body)
        elements = response_body['elements']
        self._verify_list_get_alarm_definitions_elements(
            elements, 1, res_body_create_alarm_def)
        links = response_body['links']
        self._verify_list_alarm_definitions_links(links)
开发者ID:Missxiaoguo,项目名称:monasca-api,代码行数:32,代码来源:test_alarm_definitions.py


示例9: test_create_alarm_definition_with_notification

    def test_create_alarm_definition_with_notification(self):
        notification_name = data_utils.rand_name('notification-')
        notification_type = 'EMAIL'
        notification_address = '[email protected]'
        resp, response_body = self.monasca_client.create_notification_method(
            name=notification_name, type=notification_type,
            address=notification_address)
        notification_id = self._verify_create_notification_method(
            resp, response_body, notification_name, notification_type,
            notification_address)

        # Create an alarm definition
        alarm_def_name = data_utils.rand_name('monitoring_alarm_definition')
        expression = "mem_total_mb > 0"
        alarm_definition = helpers.create_alarm_definition(
            name=alarm_def_name,
            expression=expression,
            alarm_actions=[notification_id],
            ok_actions=[notification_id],
            undetermined_actions=[notification_id],
            severity="LOW")
        resp, response_body = self.monasca_client.create_alarm_definitions(
            alarm_definition)
        self._verify_create_alarm_definitions(resp, response_body,
                                              alarm_definition)
        self.assertEqual(notification_id, response_body['ok_actions'][0])
        self.assertEqual(notification_id, response_body['alarm_actions'][0])
        self.assertEqual(notification_id,
                         response_body['undetermined_actions'][0])

        self._delete_notification(notification_id)
开发者ID:Missxiaoguo,项目名称:monasca-api,代码行数:31,代码来源:test_alarm_definitions.py


示例10: test_create_get_delete_service

 def test_create_get_delete_service(self):
     # GET Service
     # Creating a Service
     name = data_utils.rand_name('service')
     s_type = data_utils.rand_name('type')
     description = data_utils.rand_name('description')
     service_data = self.services_client.create_service(
         name=name, type=s_type,
         description=description)['OS-KSADM:service']
     self.assertFalse(service_data['id'] is None)
     self.addCleanup(self._del_service, service_data['id'])
     # Verifying response body of create service
     self.assertIn('id', service_data)
     self.assertIn('name', service_data)
     self.assertEqual(name, service_data['name'])
     self.assertIn('type', service_data)
     self.assertEqual(s_type, service_data['type'])
     self.assertIn('description', service_data)
     self.assertEqual(description, service_data['description'])
     # Get service
     fetched_service = (
         self.services_client.show_service(service_data['id'])
         ['OS-KSADM:service'])
     # verifying the existence of service created
     self.assertIn('id', fetched_service)
     self.assertEqual(fetched_service['id'], service_data['id'])
     self.assertIn('name', fetched_service)
     self.assertEqual(fetched_service['name'], service_data['name'])
     self.assertIn('type', fetched_service)
     self.assertEqual(fetched_service['type'], service_data['type'])
     self.assertIn('description', fetched_service)
     self.assertEqual(fetched_service['description'],
                      service_data['description'])
开发者ID:varuntiwari27,项目名称:tempest,代码行数:33,代码来源:test_services.py


示例11: test_list_alarm_definitions_with_multiple_dimensions

    def test_list_alarm_definitions_with_multiple_dimensions(self):
        # Create an alarm definition with random dimensions
        name = data_utils.rand_name('alarm_definition')
        dimensions = {data_utils.rand_name('key-1'): data_utils.rand_name('value-1'),
                      data_utils.rand_name('key-2'): data_utils.rand_name('value-2')}
        dimension_strings = [key + '=' + value for key, value in dimensions.items()]
        expression = 'avg(cpu_utilization{' + ','.join(dimension_strings) + '}) >= 1000'

        alarm_definition = helpers.create_alarm_definition(
            name=name,
            description="description",
            expression=expression)
        resp, res_body_create_alarm_def = self.monasca_client.\
            create_alarm_definitions(alarm_definition)
        self.assertEqual(201, resp.status)

        # List alarms
        query_dimensions = [key + ':' + value for key, value in dimensions.items()]
        query_parms = '?dimensions=' + ','.join(query_dimensions)
        resp, response_body = self.monasca_client.list_alarm_definitions(query_parms)
        self._verify_list_alarm_definitions_response_body(resp, response_body)

        elements = response_body['elements']
        self._verify_list_get_alarm_definitions_elements(
            elements, 1, res_body_create_alarm_def)

        links = response_body['links']
        self._verify_list_alarm_definitions_links(links)
开发者ID:Missxiaoguo,项目名称:monasca-api,代码行数:28,代码来源:test_alarm_definitions.py


示例12: test_aggregate_basic_ops

    def test_aggregate_basic_ops(self):
        self.useFixture(fixtures.LockFixture('availability_zone'))
        az = 'foo_zone'
        aggregate_name = data_utils.rand_name('aggregate-scenario')
        aggregate = self._create_aggregate(name=aggregate_name,
                                           availability_zone=az)

        metadata = {'meta_key': 'meta_value'}
        self._set_aggregate_metadata(aggregate, metadata)

        host = self._get_host_name()
        self._add_host(aggregate['id'], host)
        self._check_aggregate_details(aggregate, aggregate_name, az, [host],
                                      metadata)

        aggregate_name = data_utils.rand_name('renamed-aggregate-scenario')
        # Updating the name alone. The az must be specified again otherwise
        # the tempest client would send None in the put body
        aggregate = self._update_aggregate(aggregate, aggregate_name, az)

        new_metadata = {'foo': 'bar'}
        self._set_aggregate_metadata(aggregate, new_metadata)

        self._check_aggregate_details(aggregate, aggregate['name'], az,
                                      [host], new_metadata)
开发者ID:CiscoSystems,项目名称:tempest,代码行数:25,代码来源:test_aggregates_basic_ops.py


示例13: test_get_updated_quotas

    def test_get_updated_quotas(self):
        # Verify that GET shows the updated quota set of tenant
        tenant_name = data_utils.rand_name('cpu_quota_tenant_')
        tenant_desc = tenant_name + '-desc'
        identity_client = self.os_adm.identity_client
        _, tenant = identity_client.create_tenant(name=tenant_name,
                                                  description=tenant_desc)
        tenant_id = tenant['id']
        self.addCleanup(identity_client.delete_tenant, tenant_id)

        self.adm_client.update_quota_set(tenant_id, ram='5120')
        resp, quota_set = self.adm_client.get_quota_set(tenant_id)
        self.assertEqual(200, resp.status)
        self.assertEqual(5120, quota_set['ram'])

        # Verify that GET shows the updated quota set of user
        user_name = data_utils.rand_name('cpu_quota_user_')
        password = data_utils.rand_name('password-')
        email = user_name + '@testmail.tm'
        _, user = identity_client.create_user(name=user_name,
                                              password=password,
                                              tenant_id=tenant_id,
                                              email=email)
        user_id = user['id']
        self.addCleanup(identity_client.delete_user, user_id)

        self.adm_client.update_quota_set(tenant_id,
                                         user_id=user_id,
                                         ram='2048')
        resp, quota_set = self.adm_client.get_quota_set(tenant_id,
                                                        user_id=user_id)
        self.assertEqual(200, resp.status)
        self.assertEqual(2048, quota_set['ram'])
开发者ID:armando-migliaccio,项目名称:tempest-1,代码行数:33,代码来源:test_quotas.py


示例14: _create_creds

 def _create_creds(self, suffix=None, admin=False):
     rand_name_root = rand_name(self.name)
     if suffix:
         rand_name_root += suffix
     tenant_name = rand_name_root + "-tenant"
     tenant_desc = tenant_name + "-desc"
     rand_name_root = rand_name(self.name)
     tenant = self._create_tenant(name=tenant_name,
                                  description=tenant_desc)
     if suffix:
         rand_name_root += suffix
     username = rand_name_root + "-user"
     email = rand_name_root + "@example.com"
     user = self._create_user(username, self.password,
                              tenant, email)
     if admin:
         role = None
         try:
             roles = self._list_roles()
             if self.tempest_client:
                 role = next(r for r in roles if r['name'] == 'admin')
             else:
                 role = next(r for r in roles if r.name == 'admin')
         except StopIteration:
             msg = "No admin role found"
             raise exceptions.NotFound(msg)
         if self.tempest_client:
             self._assign_user_role(tenant['id'], user['id'], role['id'])
         else:
             self._assign_user_role(tenant.id, user.id, role.id)
     return user, tenant
开发者ID:pradeepkumars,项目名称:tempest,代码行数:31,代码来源:isolated_creds.py


示例15: _create_type_and_volume

    def _create_type_and_volume(self, backend_name_key, with_prefix):
        # Volume/Type creation
        type_name = data_utils.rand_name('Type')
        vol_name = data_utils.rand_name('Volume')
        spec_key_with_prefix = "capabilities:volume_backend_name"
        spec_key_without_prefix = "volume_backend_name"
        if with_prefix:
            extra_specs = {spec_key_with_prefix: backend_name_key}
        else:
            extra_specs = {spec_key_without_prefix: backend_name_key}
        self.type = self.volume_types_client.create_volume_type(
            type_name, extra_specs=extra_specs)
        self.volume_type_id_list.append(self.type['id'])

        params = {self.name_field: vol_name, 'volume_type': type_name}

        self.volume = self.admin_volume_client.create_volume(size=1,
                                                             **params)
        if with_prefix:
            self.volume_id_list_with_prefix.append(self.volume['id'])
        else:
            self.volume_id_list_without_prefix.append(
                self.volume['id'])
        self.admin_volume_client.wait_for_volume_status(
            self.volume['id'], 'available')
开发者ID:midokura,项目名称:tempest,代码行数:25,代码来源:test_multi_backend.py


示例16: test_patch_actions_in_alarm_definition

    def test_patch_actions_in_alarm_definition(self):
        notification_name = data_utils.rand_name('notification-')
        notification_type = 'EMAIL'
        address = '[email protected]'

        resp, response_body = self.monasca_client.create_notification_method(
            notification_name, type=notification_type, address=address)
        notification_id = self._verify_create_notification_method(
            resp, response_body, notification_name, notification_type, address)

        # Create an alarm definition
        response_body_list = self._create_alarm_definitions(
            expression=None, number_of_definitions=1)
        # Patch alarm definition
        patch_alarm_def_name = data_utils.rand_name('monitoring_alarm_update')
        resp, body = self.monasca_client.patch_alarm_definition(
            response_body_list[0]['id'],
            name=patch_alarm_def_name,
            expression=response_body_list[0]['expression'],
            actions_enabled='true',
            alarm_actions=[notification_id],
            ok_actions=[notification_id],
            undetermined_actions=[notification_id]
        )
        self.assertEqual(200, resp.status)
        self._verify_update_patch_alarm_definition(body, patch_alarm_def_name,
                                                   None, None, notification_id)
        # Get and verify details of an alarm after update
        resp, response_body = self.monasca_client.get_alarm_definition(
            response_body_list[0]['id'])
        self._verify_update_patch_alarm_definition(response_body,
                                                   patch_alarm_def_name, None,
                                                   None, notification_id)
        self._delete_notification(notification_id)
开发者ID:Missxiaoguo,项目名称:monasca-api,代码行数:34,代码来源:test_alarm_definitions.py


示例17: setUpClass

    def setUpClass(cls):
        super(ListImageFiltersTestJSON, cls).setUpClass()
        cls.client = cls.images_client

        resp, cls.server1 = cls.create_server()
        resp, cls.server2 = cls.create_server(wait_until='ACTIVE')
        # NOTE(sdague) this is faster than doing the sync wait_util on both
        cls.servers_client.wait_for_server_status(cls.server1['id'], 'ACTIVE')

        # Create images to be used in the filter tests
        image1_name = rand_name('image')
        resp, body = cls.client.create_image(cls.server1['id'], image1_name)
        cls.image1_id = parse_image_id(resp['location'])
        cls.client.wait_for_image_resp_code(cls.image1_id, 200)
        cls.client.wait_for_image_status(cls.image1_id, 'ACTIVE')
        resp, cls.image1 = cls.client.get_image(cls.image1_id)

        # Servers have a hidden property for when they are being imaged
        # Performing back-to-back create image calls on a single
        # server will sometimes cause failures
        image3_name = rand_name('image')
        resp, body = cls.client.create_image(cls.server2['id'], image3_name)
        cls.image3_id = parse_image_id(resp['location'])
        cls.client.wait_for_image_resp_code(cls.image3_id, 200)
        cls.client.wait_for_image_status(cls.image3_id, 'ACTIVE')
        resp, cls.image3 = cls.client.get_image(cls.image3_id)

        image2_name = rand_name('image')
        resp, body = cls.client.create_image(cls.server1['id'], image2_name)
        cls.image2_id = parse_image_id(resp['location'])
        cls.client.wait_for_image_resp_code(cls.image2_id, 200)
        cls.client.wait_for_image_status(cls.image2_id, 'ACTIVE')
        resp, cls.image2 = cls.client.get_image(cls.image2_id)
开发者ID:rushiagr,项目名称:tempest,代码行数:33,代码来源:test_list_image_filters.py


示例18: populate_spam_table

    def populate_spam_table(self, table_name, usercount, itemcount):

        dates = ['2013-12-0%sT16:00:00.000001' % i for i in range(1, 8)]
        from_headers = ["%[email protected]" % rand_name() for _ in range(10)]
        to_headers = ["%[email protected]" % rand_name() for _ in range(10)]
        emails = []

        new_items = []
        for _ in range(usercount):
            email = "%[email protected]" % rand_name()
            emails.append(email)

            for item in range(itemcount):
                message_id = rand_uuid()
                date = random.choice(dates)
                # put item
                item = {
                    "user_id": {"S": email},
                    "date_message_id": {"S": date + "#" + message_id},
                    "message_id": {"S": message_id},
                    "from_header": {"S": random.choice(from_headers)},
                    "to_header": {"S": random.choice(to_headers)},
                }
                new_items.append(item)
                self.conn.put_item(table_name, item)
        return new_items
开发者ID:chjwang,项目名称:magnetodb,代码行数:26,代码来源:test_load_1.py


示例19: test_create_vip_as_admin_for_another_tenant

 def test_create_vip_as_admin_for_another_tenant(self):
     name = data_utils.rand_name('vip-')
     resp, body = self.admin_client.create_pool(
         name=data_utils.rand_name('pool-'), lb_method="ROUND_ROBIN",
         protocol="HTTP", subnet_id=self.subnet['id'],
         tenant_id=self.tenant_id)
     self.assertEqual('201', resp['status'])
     pool = body['pool']
     self.addCleanup(self.admin_client.delete_pool, pool['id'])
     resp, body = self.admin_client.create_vip(name=name,
                                               protocol="HTTP",
                                               protocol_port=80,
                                               subnet_id=self.subnet['id'],
                                               pool_id=pool['id'],
                                               tenant_id=self.tenant_id)
     self.assertEqual('201', resp['status'])
     vip = body['vip']
     self.addCleanup(self.admin_client.delete_vip, vip['id'])
     self.assertIsNotNone(vip['id'])
     self.assertEqual(self.tenant_id, vip['tenant_id'])
     resp, body = self.client.show_vip(vip['id'])
     self.assertEqual('200', resp['status'])
     show_vip = body['vip']
     self.assertEqual(vip['id'], show_vip['id'])
     self.assertEqual(vip['name'], show_vip['name'])
开发者ID:adkerr,项目名称:tempest,代码行数:25,代码来源:test_load_balancer_admin_actions.py


示例20: test_create_list_update_show_delete_security_group

    def test_create_list_update_show_delete_security_group(self):
        group_create_body, name = self._create_security_group()

        # List security groups and verify if created group is there in response
        resp, list_body = self.client.list_security_groups()
        self.assertEqual('200', resp['status'])
        secgroup_list = list()
        for secgroup in list_body['security_groups']:
            secgroup_list.append(secgroup['id'])
        self.assertIn(group_create_body['security_group']['id'], secgroup_list)
        # Update the security group
        new_name = data_utils.rand_name('security-')
        new_description = data_utils.rand_name('security-description')
        resp, update_body = self.client.update_security_group(
            group_create_body['security_group']['id'],
            name=new_name,
            description=new_description)
        # Verify if security group is updated
        self.assertEqual('200', resp['status'])
        self.assertEqual(update_body['security_group']['name'], new_name)
        self.assertEqual(update_body['security_group']['description'],
                         new_description)
        # Show details of the updated security group
        resp, show_body = self.client.show_security_group(
            group_create_body['security_group']['id'])
        self.assertEqual(show_body['security_group']['name'], new_name)
        self.assertEqual(show_body['security_group']['description'],
                         new_description)
开发者ID:vmahuli,项目名称:tempest,代码行数:28,代码来源:test_security_groups.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python data_utils.rand_password函数代码示例发布时间:2022-05-27
下一篇:
Python data_utils.rand_mac_address函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap