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

Python data_utils.rand_int_id函数代码示例

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

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: test_request_message_by_passing_invalid_echo_param

 def test_request_message_by_passing_invalid_echo_param(self):
     # Value of the echo parameter must be either true or false
     echo = None
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     uri = "/v2/queues/{0}/messages?echo={1}".format(queue_name, echo)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.show_multiple_messages, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:8,代码来源:test_messages_negative.py


示例17: test_create_flavor_using_string_ram

    def test_create_flavor_using_string_ram(self):
        new_flavor_id = data_utils.rand_int_id(start=1000)

        ram = "1024"
        flavor = self.create_flavor(ram=ram, vcpus=self.vcpus,
                                    disk=self.disk,
                                    id=new_flavor_id)
        self.assertEqual(flavor['ram'], int(ram))
        self.assertEqual(int(flavor['id']), new_flavor_id)
开发者ID:Juniper,项目名称:tempest,代码行数:9,代码来源:test_flavors.py


示例18: test_request_messages_by_passing_invalid_include_claimed_param

 def test_request_messages_by_passing_invalid_include_claimed_param(self):
     # Value of include_claimed param must be either true or false
     value = None
     queue = self.queues[data_utils.rand_int_id(0,
                                                len(self.queues) - 1)]
     uri = "/v2/queues/{0}/messages?include_claimed={1}".format(queue,
                                                                value)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.show_multiple_messages, uri)
开发者ID:AvnishPal,项目名称:zaqar,代码行数:9,代码来源:test_messages_negative.py


示例19: test_delete_message_with_non_existent_message_id

 def test_delete_message_with_non_existent_message_id(self):
     # Delete is an idempotent operation
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     message_id = str(uuid.uuid4())
     uri = "/v2/queues/{0}/messages/{1}".format(queue_name,
                                                message_id)
     resp, _ = self.client.delete_messages(uri)
     self.assertEqual('204', resp['status'])
开发者ID:AvnishPal,项目名称:zaqar,代码行数:9,代码来源:test_messages_negative.py


示例20: test_request_a_message_with_negative_message_id

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python data_utils.rand_mac_address函数代码示例发布时间:2022-05-27
下一篇:
Python data_utils.arbitrary_string函数代码示例发布时间: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