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


Python data_utils.rand_int_id函数代码示例

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


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

示例1: test_request_messages_with_limit_less_than_configured_value

 def test_request_messages_with_limit_less_than_configured_value(self):
     # Default limit value is 20 , configurable
     invalid_limit = data_utils.rand_int_id(-1000, 0)
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     uri = "/v2/queues/{0}/messages?limit={1}".format(queue_name,
                                                      invalid_limit)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.show_multiple_messages, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:9,代码来源:test_messages_negative.py

示例2: test_create_flavor_with_int_id

 def test_create_flavor_with_int_id(self):
     flavor_id = data_utils.rand_int_id(start=1000)
     new_flavor_id = self.create_flavor(ram=self.ram,
                                        vcpus=self.vcpus,
                                        disk=self.disk,
                                        id=flavor_id)['id']
     self.assertEqual(new_flavor_id, str(flavor_id))
开发者ID:Juniper,项目名称:tempest,代码行数:7,代码来源:test_flavors.py

示例3: test_create_update_and_delete_domain_config_groups_and_opts

    def test_create_update_and_delete_domain_config_groups_and_opts(self):
        domain, _ = self._create_domain_and_config(self.custom_config)

        # Check that updating configuration groups work.
        new_driver = data_utils.rand_name('driver')
        new_limit = data_utils.rand_int_id(0, 100)
        new_group_config = {'identity': {'driver': new_driver,
                                         'list_limit': new_limit}}

        updated_config = self.client.update_domain_group_config(
            domain['id'], 'identity', **new_group_config)['config']

        self.assertEqual(new_driver, updated_config['identity']['driver'])
        self.assertEqual(new_limit, updated_config['identity']['list_limit'])

        # Check that updating individual configuration group options work.
        new_driver = data_utils.rand_name('driver')

        updated_config = self.client.update_domain_group_option_config(
            domain['id'], 'identity', 'driver', driver=new_driver)['config']

        self.assertEqual(new_driver, updated_config['identity']['driver'])

        # Check that deleting individual configuration group options work.
        self.client.delete_domain_group_option_config(
            domain['id'], 'identity', 'driver')
        self.assertRaises(lib_exc.NotFound,
                          self.client.show_domain_group_option_config,
                          domain['id'], 'identity', 'driver')

        # Check that deleting configuration groups work.
        self.client.delete_domain_group_config(domain['id'], 'identity')
        self.assertRaises(lib_exc.NotFound,
                          self.client.show_domain_group_config,
                          domain['id'], 'identity')
开发者ID:openstack,项目名称:tempest,代码行数:35,代码来源:test_domain_configuration.py

示例4: resource_setup

    def resource_setup(cls):
        super(FlavorsExtraSpecsNegativeTestJSON, cls).resource_setup()

        flavor_name = data_utils.rand_name('test_flavor')
        ram = 512
        vcpus = 1
        disk = 10
        ephemeral = 10
        new_flavor_id = data_utils.rand_int_id(start=1000)
        swap = 1024
        rxtx = 1
        # Create a flavor
        cls.flavor = cls.admin_flavors_client.create_flavor(
            name=flavor_name,
            ram=ram, vcpus=vcpus,
            disk=disk,
            id=new_flavor_id,
            ephemeral=ephemeral,
            swap=swap,
            rxtx_factor=rxtx)['flavor']
        cls.addClassResourceCleanup(
            cls.admin_flavors_client.wait_for_resource_deletion,
            cls.flavor['id'])
        cls.addClassResourceCleanup(cls.admin_flavors_client.delete_flavor,
                                    cls.flavor['id'])
开发者ID:Juniper,项目名称:tempest,代码行数:25,代码来源:test_flavors_extra_specs_negative.py

示例5: test_post_messages_with_invalid_json_request_body

 def test_post_messages_with_invalid_json_request_body(self):
     # Post messages to a queue with non-JSON request body
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     body = "123"
     self.assertRaises(lib_exc.BadRequest,
                       self.client.post_messages, queue_name, body)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:7,代码来源:test_messages_negative.py

示例6: test_post_messages_with_a_bad_message

 def test_post_messages_with_a_bad_message(self):
     # Post message with invalid message format
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     body = {'[]', '.'}
     self.assertRaises(lib_exc.BadRequest,
                       self.client.post_messages, queue_name, body)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:7,代码来源:test_messages_negative.py

示例7: test_post_messages_with_no_request_body

 def test_post_messages_with_no_request_body(self):
     # Post message with empty body
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     body = {}
     self.assertRaises(lib_exc.BadRequest,
                       self.client.post_messages, queue_name, body)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:7,代码来源:test_messages_negative.py

示例8: test_volume_list_details_by_name

 def test_volume_list_details_by_name(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     params = {'name': volume['name']}
     fetched_vol = self.volumes_client.list_volumes(
         detail=True, params=params)['volumes']
     self.assertEqual(1, len(fetched_vol), str(fetched_vol))
     self.assertEqual(fetched_vol[0]['name'], volume['name'])
开发者ID:masayukig,项目名称:tempest,代码行数:7,代码来源:test_volumes_list.py

示例9: rand_ttl

def rand_ttl(start=1, end=86400):
    """Generate a random TTL value
    :return: a random ttl e.g. 165
    :rtype: string
    """
    start = max(start, CONF.dns.min_ttl)
    return data_utils.rand_int_id(start, end)
开发者ID:paperandsoap,项目名称:designate-tempest-plugin,代码行数:7,代码来源:data_utils.py

示例10: test_request_a_non_existing_message

 def test_request_a_non_existing_message(self):
     # List a message with an invalid id
     invalid_id = str(uuid.uuid4())
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     uri = "/v2/queues/{0}/messages/{1}".format(queue_name, invalid_id)
     self.assertRaises(lib_exc.NotFound,
                       self.client.show_single_message, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_messages_negative.py

示例11: test_volume_list_by_name

 def test_volume_list_by_name(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     params = {self.name: volume[self.name]}
     fetched_vol = self.volumes_client.list_volumes(
         params=params)['volumes']
     self.assertEqual(1, len(fetched_vol), str(fetched_vol))
     self.assertEqual(fetched_vol[0][self.name],
                      volume[self.name])
开发者ID:vedujoshi,项目名称:tempest,代码行数:8,代码来源:test_volumes_list.py

示例12: test_delete_message_with_negative_pop_value

 def test_delete_message_with_negative_pop_value(self):
     # Pop value must be at least 1 and may not be greater than 20
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     value = '-1'
     uri = "/v2/queues/{0}/messages?pop={1}".format(queue_name, value)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.delete_messages, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_messages_negative.py

示例13: test_delete_multiple_messages_by_exceeding_the_default_limit

 def test_delete_multiple_messages_by_exceeding_the_default_limit(self):
     # Default limit value is 20
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     ids = str.join(',', (str(uuid.uuid4())) * 21)
     uri = "/v2/queues/{0}/messages?ids={1}".format(queue_name, ids)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.delete_messages, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_messages_negative.py

示例14: test_delete_the_deleted_queue

 def test_delete_the_deleted_queue(self):
     # Delete is an idempotent operation
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     self.client.delete_queue(queue_name)
     # Delete again
     resp, _ = self.client.delete_queue(queue_name)
     self.assertEqual('204', resp['status'])
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_queues_negative.py

示例15: test_request_queue_stats_after_deleting_queue

 def test_request_queue_stats_after_deleting_queue(self):
     # List queue stats after deleting the queue
     # DELETE is an idempotent operation
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     self.client.delete_queue(queue_name)
     resp, _ = self.client.show_queue_stats(queue_name)
     self.assertEqual('200', resp['status'])
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_queues_negative.py


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