示例#1
0
 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)
示例#2
0
 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)
示例#3
0
    def resource_setup(cls):
        super(TestNumaResize,cls).resource_setup()
        flavor_name_1=data_utils.rand_name('test_flavor_1')
        ram_1=4096
        vcpus_1=4
        disk_1=10
        ephemeral_1=10
        flavor_id_1=data_utils.rand_int_id(start=1000)
        swap_1=1024
        rxtx_1=1
    
        flavor_name_2=data_utils.rand_name('test_flavor_2')
        ram_2=8192
        flavor_id_2=data_utils.rand_int_id(start=1000)


        cls.flavor_1=cls.admin_flavors_client.create_flavor(
                name=flavor_name_1,
                ram=ram_1,
                vcpus=vcpus_1,
                disk=disk_1,
                id=flavor_id_1,
                ephemeral=ephemeral_1,
                swap=swap_1,
                rxtx_factor=rxtx_1)['flavor']



        cls.flavor_2=cls.admin_flavors_client.create_flavor(
                name=flavor_name_2,
                ram=ram_2,
                vcpus=vcpus_1,
                disk=disk_1,
                id=flavor_id_2,
                ephemeral=ephemeral_1,
                swap=swap_1,
                rxtx_factor=rxtx_1)['flavor']

        cls.addClassResourceCleanup(
                    cls.admin_flavors_client.wait_for_resource_deletion,
                    cls.flavor_1['id'])

        cls.addClassResourceCleanup(
                    cls.admin_flavors_client.delete_flavor,
                    cls.flavor_1['id'])

        cls.addClassResourceCleanup(
                    cls.admin_flavors_client.wait_for_resource_deletion,
                    cls.flavor_2['id'])

        cls.addClassResourceCleanup(
                    cls.admin_flavors_client.delete_flavor,
                    cls.flavor_2['id'])
示例#4
0
 def _create_flavor(cls, **kwargs):
     flavor_kwargs = {
         "name": data_utils.rand_name(cls.__name__ + '-flavor'),
         "ram": data_utils.rand_int_id(1, 10),
         "vcpus": data_utils.rand_int_id(1, 10),
         "disk": data_utils.rand_int_id(1, 10),
         "id": data_utils.rand_uuid(),
     }
     if kwargs:
         flavor_kwargs.update(kwargs)
     flavor = cls.flavors_client.create_flavor(**flavor_kwargs)['flavor']
     cls.flavors.append(flavor)
     return flavor
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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)
 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'])
示例#12
0
 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))
示例#13
0
 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))
示例#14
0
 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'])
示例#15
0
 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])
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)
    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')
    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'])
 def resource_setup(cls):
     super(FlavorsExtraSpecsTestJSON, cls).resource_setup()
     flavor_name = data_utils.rand_name('test_flavor')
     ram = 4096
     vcpus = 4
     disk = 10
     ephemeral = 10
     new_flavor_id = data_utils.rand_int_id(start=1000)
     swap = 1024
     rxtx = 1
     # Create a flavor so as to set/get/unset extra specs
     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'])
示例#20
0
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)
示例#21
0
 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)
示例#22
0
 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)
示例#23
0
 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'])
示例#24
0
 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'])
示例#25
0
 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)
示例#26
0
 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)
示例#27
0
 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)
示例#28
0
 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)
示例#29
0
 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(',', (uuidutils.generate_uuid()) * 21)
     uri = "/v2/queues/{0}/messages?ids={1}".format(queue_name, ids)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.delete_messages, uri)
示例#30
0
 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'])
示例#31
0
 def test_volume_list_by_name(self):
     """Test getting a list of volumes filtered by volume name"""
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     params = {'name': volume['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]['name'], volume['name'])
示例#32
0
 def test_request_multiple_messages_by_exceeding_the_default_limit(self):
     # Default limit value is 20 , configurable
     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.show_multiple_messages, uri)
示例#33
0
 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)
示例#34
0
 def create_flavor(cls, **kwargs):
     flavor_kwargs = {
         "name": data_utils.rand_name(cls.__name__ + '-flavor'),
         "ram": data_utils.rand_int_id(1, 10),
         "vcpus": data_utils.rand_int_id(1, 10),
         "disk": data_utils.rand_int_id(1, 10),
         "id": data_utils.rand_uuid(),
     }
     if kwargs:
         flavor_kwargs.update(kwargs)
     flavor = cls.flavors_client.create_flavor(**flavor_kwargs)['flavor']
     cls.addClassResourceCleanup(
         cls.flavors_client.wait_for_resource_deletion, flavor['id'])
     cls.addClassResourceCleanup(
         test_utils.call_and_ignore_notfound_exc,
         cls.flavors_client.delete_flavor, flavor['id'])
     return flavor
示例#35
0
 def test_request_a_non_existing_message(self):
     # List a message with an invalid id
     invalid_id = uuidutils.generate_uuid()
     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)
示例#36
0
 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])
示例#37
0
 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'])
示例#38
0
 def test_create_flavor_with_int_id(self):
     """Test creating flavor with id of type integer"""
     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))
示例#39
0
 def test_volumes_list_by_availability_zone(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     zone = volume['availability_zone']
     params = {'availability_zone': zone}
     fetched_list = self.volumes_client.list_volumes(
         params=params)['volumes']
     self._list_by_param_value_and_assert(params)
     self.assertVolumesIn(fetched_list, self.volume_list,
                          fields=self.VOLUME_FIELDS)
示例#40
0
 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)
示例#41
0
 def test_volumes_list_by_availability_zone(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     zone = volume['availability_zone']
     params = {'availability_zone': zone}
     fetched_list = self.volumes_client.list_volumes(
         params=params)['volumes']
     self._list_by_param_value_and_assert(params)
     self.assertVolumesIn(fetched_list, self.volume_list,
                          fields=self.VOLUME_FIELDS)
示例#42
0
 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 = uuidutils.generate_uuid()
     uri = "/v2/queues/{0}/messages/{1}".format(queue_name,
                                                message_id)
     resp, _ = self.client.delete_messages(uri)
     self.assertEqual('204', resp['status'])
示例#43
0
 def test_delete_a_non_existing_message(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?ids={1}".format(queue_name,
                                                    message_id)
     resp, _ = self.client.delete_messages(uri)
     self.assertEqual('204', resp['status'])
示例#44
0
    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)
示例#45
0
 def test_list_messages_with_invalid_token(self):
     # List messages without a valid token
     queue_name = self.queues[data_utils.rand_int_id(
         0,
         len(self.queues) - 1)]
     self.client.auth_provider.set_alt_auth_data(request_part='headers',
                                                 auth_data=None)
     self.assertRaises(lib_exc.Unauthorized, self.client.list_messages,
                       queue_name)
示例#46
0
 def test_volumes_list_details_by_availability_zone(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     zone = volume['availability_zone']
     params = {'availability_zone': zone}
     fetched_list = self.volumes_client.list_volumes(
         detail=True, params=params)['volumes']
     for volume in fetched_list:
         self.assertEqual(zone, volume['availability_zone'])
     self.assertVolumesIn(fetched_list, self.volume_list)
示例#47
0
 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'])
示例#48
0
    def test_list_container_contents_with_limit(self):
        # get container contents list using limit param
        container_name = self.create_container()
        object_name, _ = self.create_object(container_name)

        params = {"limit": data_utils.rand_int_id(1, 10000)}
        resp, object_list = self.container_client.list_container_contents(container_name, params=params)
        self.assertHeaders(resp, "Container", "GET")
        self.assertEqual(object_name, object_list.strip("\n"))
示例#49
0
 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)
 def test_volumes_list_details_by_availability_zone(self):
     volume = self.volume_list[data_utils.rand_int_id(0, 2)]
     zone = volume['availability_zone']
     params = {'availability_zone': zone}
     fetched_list = self.volumes_client.list_volumes(
         detail=True, params=params)['volumes']
     for volume in fetched_list:
         self.assertEqual(zone, volume['availability_zone'])
     self._assert_volumes_in(fetched_list, self.volume_list)
 def test_get_nonexistent_floating_ip_details(self):
     """Test getting non existent floating ip should fail"""
     # Creating a non-existent floatingIP id
     if CONF.service_available.neutron:
         non_exist_id = data_utils.rand_uuid()
     else:
         non_exist_id = data_utils.rand_int_id(start=999)
     self.assertRaises(lib_exc.NotFound, self.client.show_floating_ip,
                       non_exist_id)
示例#52
0
 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)
 def test_get_nonexistent_floating_ip_details(self):
     # Negative test:Should not be able to GET the details
     # of non-existent floating IP
     # Creating a non-existent floatingIP id
     if CONF.service_available.neutron:
         non_exist_id = data_utils.rand_uuid()
     else:
         non_exist_id = data_utils.rand_int_id(start=999)
     self.assertRaises(lib_exc.NotFound,
                       self.client.show_floating_ip, non_exist_id)
示例#54
0
 def test_request_multiple_messages_with_invalid_message_id(self):
     # List multiple messages by passing 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?ids={1},{2}".format(queue_name,
                                                        invalid_id,
                                                        invalid_id)
     self.assertRaises(lib_exc.NotFound,
                       self.client.show_multiple_messages, uri)
示例#55
0
 def test_update_a_non_existing_claim(self):
     # Update a non existing claim
     claim_ttl = data_utils.rand_int_id(start=60,
                                        end=CONF.messaging.max_claim_ttl)
     update_rbody = {"ttl": claim_ttl}
     claim_id = str(uuid.uuid4())
     claim_uri = "/v2/queues/{0}/claims/{1}".format(self.queue_name,
                                                    claim_id)
     self.assertRaises(lib_exc.NotFound,
                       self.client.update_claim, claim_uri, update_rbody)
示例#56
0
 def test_update_claim_on_non_existing_queue(self):
     # Update claim on a non existing queue
     resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
     self.client.delete_queue(self.queue_name)
     claim_ttl = data_utils.rand_int_id(start=60,
                                        end=CONF.messaging.max_claim_ttl)
     update_rbody = {"ttl": claim_ttl}
     claim_uri = resp['location'][resp['location'].find('/v2'):]
     self.assertRaises(lib_exc.NotFound,
                       self.client.update_claim, claim_uri, update_rbody)
def rand_quotas(zones=None, zone_records=None, zone_recordsets=None,
                recordset_records=None, api_export_size=None):
    LOG.warn("Leaving `api_export_size` out of quota data due to: "
             "https://bugs.launchpad.net/designate/+bug/1573141")
    return {
        'quota': {
            'zones':
                zones or data_utils.rand_int_id(100, 999999),
            'zone_records':
                zone_records or data_utils.rand_int_id(100, 999999),
            'zone_recordsets':
                zone_recordsets or data_utils.rand_int_id(100, 999999),
            'recordset_records':
                recordset_records or data_utils.rand_int_id(100, 999999),
            # https://bugs.launchpad.net/designate/+bug/1573141
            # 'api_export_size':
            #     api_export_size or data_utils.rand_int_id(100, 999999),
        }
    }
示例#58
0
 def test_delete_message_without_id(self):
     # Delete all the message from a queue
     # without passing any id
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     message_body = self.generate_message_body(repeat=1)
     self.post_messages(queue_name, message_body)
     uri = "/v2/queues/{0}/messages".format(queue_name)
     self.assertRaises(lib_exc.BadRequest,
                       self.client.delete_messages, uri)
示例#59
0
 def test_list_messages_with_invalid_token(self):
     # List messages without a valid token
     queue_name = self.queues[data_utils.rand_int_id(0,
                                                     len(self.queues) - 1)]
     self.client.auth_provider.set_alt_auth_data(
         request_part='headers',
         auth_data=None
     )
     self.assertRaises(lib_exc.Unauthorized,
                       self.client.list_messages, queue_name)