def RegisterImageRestricted():
        """
        @summary: Generates a dataset list of properties that are restricted
        for the register image request

        @return: Dataset_list
        @rtype: DatasetList
        """

        image_id = str(uuid.uuid1())

        # Properties that are read-only
        checksum = random_string()
        created_at = str(datetime.now())
        file_ = '/v2/images/{0}/file'.format(image_id)
        schema = Schemas.IMAGE_MEMBER_SCHEMA
        self_ = '/v2/images/{0}'.format(image_id)
        size = random_int(0, 9999999)
        status = ImageStatus.ACTIVE
        updated_at = str(datetime.now())

        # Properties that are reserved
        owner = str(random_int(0, 999999))

        data_dict = {
            'passing_checksum': {'checksum': checksum},
            'passing_created_at': {'created_at': created_at},
            'passing_file': {'file': file_},
            'passing_schema': {'schema': schema},
            'passing_self': {'self': self_}, 'passing_size': {'size': size},
            'passing_status': {'status': status},
            'passing_updated_at': {'updated_at': updated_at},
            'passing_owner': {'owner': owner}}

        return build_basic_dataset(data_dict, 'prop')
    def ListImagesFilters():
        """
        @summary: Generates a dataset list of filters for the list images
        request

        @return: Dataset_list
        @rtype: DatasetList
        """

        auto_disk_config = 'False'
        checksum = random_string()
        container_format = ImageContainerFormat.AMI
        created_at = datetime.now()
        disk_format = ImageDiskFormat.RAW
        id_ = str(uuid.uuid1())
        image_type = ImageType.IMPORT
        min_disk = images.config.min_disk
        min_ram = images.config.min_ram
        name = rand_name('image')
        os_type = ImageOSType.LINUX
        owner = random_int(0, 999999)
        protected = False
        size = random_int(0, 9999999)
        status = ImageStatus.ACTIVE
        updated_at = datetime.now()
        user_id = random_string()
        visibility = ImageVisibility.PUBLIC

        data_dict = {'passing_auto_disk_config':
                     {'auto_disk_config': auto_disk_config},
                     'passing_checksum': {'checksum': checksum},
                     'passing_container_format':
                     {'container_format': container_format},
                     'passing_created_at': {'created_at': created_at},
                     'passing_disk_format': {'disk_format': disk_format},
                     'passing_id': {'id_': id_},
                     'passing_image_type': {'image_type': image_type},
                     'passing_min_disk': {'min_disk': min_disk},
                     'passing_min_ram': {'min_ram': min_ram},
                     'passing_multiple_filters':
                     {'container_format': container_format,
                      'disk_format': disk_format},
                     'passing_name': {'name': name},
                     'passing_os_type': {'os_type': os_type},
                     'passing_owner': {'owner': owner},
                     'passing_protected': {'protected': protected},
                     'passing_size': {'size': size},
                     'passing_status': {'status': status},
                     'passing_updated_at': {'updated_at': updated_at},
                     'passing_user_id': {'user_id': user_id},
                     'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'params')
Exemple #3
0
    def ListImagesFilters():
        """
        @summary: Generates a dataset list of filters for the list images
        request

        @return: Dataset_list
        @rtype: DatasetList
        """

        auto_disk_config = 'False'
        checksum = random_string()
        container_format = ImageContainerFormat.AMI
        created_at = datetime.now()
        disk_format = ImageDiskFormat.RAW
        id_ = '00000000-0000-0000-0000-000000000000'
        image_type = ImageType.IMPORT
        min_disk = images.config.min_disk
        min_ram = images.config.min_ram
        name = rand_name('image')
        os_type = ImageOSType.LINUX
        owner = random_int(0, 999999)
        protected = False
        size = random_int(0, 9999999)
        status = ImageStatus.ACTIVE
        updated_at = datetime.now()
        user_id = random_string()
        visibility = ImageVisibility.PUBLIC

        data_dict = {'passing_auto_disk_config':
                     {'auto_disk_config': auto_disk_config},
                     'passing_checksum': {'checksum': checksum},
                     'passing_container_format':
                     {'container_format': container_format},
                     'passing_created_at': {'created_at': created_at},
                     'passing_disk_format': {'disk_format': disk_format},
                     'passing_id': {'id_': id_},
                     'passing_image_type': {'image_type': image_type},
                     'passing_min_disk': {'min_disk': min_disk},
                     'passing_min_ram': {'min_ram': min_ram},
                     'passing_multiple_filters':
                     {'container_format': container_format,
                      'disk_format': disk_format},
                     'passing_name': {'name': name},
                     'passing_os_type': {'os_type': os_type},
                     'passing_owner': {'owner': owner},
                     'passing_protected': {'protected': protected},
                     'passing_size': {'size': size},
                     'passing_status': {'status': status},
                     'passing_updated_at': {'updated_at': updated_at},
                     'passing_user_id': {'user_id': user_id},
                     'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'params')
    def UpdateAddRemoveImageRestricted():
        """
        @summary: Generates a dataset list of properties that are restricted
        for the update image requests to add and remove properties

        @return: Dataset_list
        @rtype: DatasetList
        """

        image_id = str(uuid.uuid1())

        # Properties that are read-only
        checksum = random_string()
        created_at = str(datetime.now())
        file_ = '/v2/images/{0}/file'.format(image_id)
        id_ = str(uuid.uuid1())
        schema = Schemas.IMAGE_MEMBER_SCHEMA
        self_ = '/v2/images/{0}'.format(image_id)
        size = random_int(0, 9999999)
        status = ImageStatus.ACTIVE
        updated_at = str(datetime.now())

        # Properties that are reserved
        image_type = ImageType.IMPORT
        location = '/v2/images/{0}/file'.format(image_id)
        os_type = ImageOSType.LINUX
        owner = str(random_int(0, 999999))
        user_id = random_string()

        # Properties that unauthorized
        visibility = ImageVisibility.PRIVATE

        data_dict = {
            'passing_id': {'id': id_},
            'passing_checksum': {'checksum': checksum},
            'passing_created_at': {'created_at': created_at},
            'passing_file': {'file': file_},
            'passing_schema': {'schema': schema},
            'passing_self': {'self': self_}, 'passing_size': {'size': size},
            'passing_status': {'status': status},
            'passing_updated_at': {'updated_at': updated_at},
            'passing_image_type': {'image_type': image_type},
            'passing_location': {'location': location},
            'passing_os_type': {'os_type': os_type},
            'passing_owner': {'owner': owner},
            'passing_user_id': {'user_id': user_id},
            'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'prop')
Exemple #5
0
    def UpdateRegisterImageRestricted():
        """
        @summary: Generates a dataset list of properties that are restricted
        for the update and register image requests

        @return: Dataset_list
        @rtype: DatasetList
        """

        # Properties that are read-only
        id_ = '00000000-0000-0000-0000-000000000000'
        checksum = random_string()
        created_at = str(datetime.now())
        file_ = '/v2/images/00000000-0000-0000-0000-000000000000/file'
        schema = Schemas.IMAGE_MEMBER_SCHEMA
        self_ = '/v2/images/00000000-0000-0000-0000-000000000000'
        size = random_int(0, 9999999)
        status = ImageStatus.ACTIVE
        updated_at = str(datetime.now())

        # Properties that are reserved
        image_type = ImageType.IMPORT
        os_type = ImageOSType.LINUX
        owner = random_int(0, 999999)
        user_id = random_string()

        # Properties that unauthorized
        visibility = ImageVisibility.PUBLIC

        data_dict = {
            'passing_id': {'id': id_},
            'passing_checksum': {'checksum': checksum},
            'passing_created_at': {'created_at': created_at},
            'passing_file': {'file': file_},
            'passing_schema': {'schema': schema},
            'passing_self': {'self': self_}, 'passing_size': {'size': size},
            'passing_status': {'status': status},
            'passing_updated_at': {'updated_at': updated_at},
            'passing_image_type': {'image_type': image_type},
            'passing_os_type': {'os_type': os_type},
            'passing_owner': {'owner': owner},
            'passing_user_id': {'user_id': user_id},
            'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'prop')
    def create_tenant(self, tenant_id=None, use_alternate=False):
        """
        Helper function for creating a tenant on a fixture
        @param self:
        @return: Returns tuple with tenant_id and response object
        """
        if tenant_id is None:
            tenant_id = str(random_int(1, 100000))
        self.tenant_ids.append(tenant_id)

        if use_alternate:
            self.tenant_client.use_alternate = use_alternate

        resp = self.tenant_client.create_tenant(tenant_id)

        if use_alternate:
            self.tenant_client.use_alternate = False
        return tenant_id, resp
Exemple #7
0
    def create_tenant(self, tenant_id=None, use_alternate=False):
        """
        Helper function for creating a tenant on a fixture
        @param self:
        @return: Returns tuple with tenant_id and response object
        """
        if tenant_id is None:
            tenant_id = str(random_int(1, 100000))
        self.tenant_ids.append(tenant_id)

        if use_alternate:
            self.tenant_client.use_alternate = use_alternate

        resp = self.tenant_client.create_tenant(tenant_id)

        if use_alternate:
            self.tenant_client.use_alternate = False
        return tenant_id, resp
    def ListImagesSmoke():
        """
        @summary: Generates a dataset list of parameters for the list images
        request for smoke tests

        @return: Dataset_list
        @rtype: DatasetList
        """

        additional_property = images.config.additional_property
        additional_property_value = images.config.additional_property_value
        auto_disk_config = 'False'
        checksum = random_string()
        container_format = ImageContainerFormat.AMI
        created_at = datetime.now()
        disk_format = ImageDiskFormat.RAW
        id_ = str(uuid.uuid1())
        image_type = ImageType.IMPORT
        limit = 10
        marker = None
        member_status = ImageMemberStatus.ACCEPTED
        min_disk = images.config.min_disk
        min_ram = images.config.min_ram
        name = rand_name('image')
        os_type = ImageOSType.LINUX
        owner = random_int(0, 999999)
        protected = False
        size = random_int(0, 9999999)
        size_max = images.config.size_max
        size_min = images.config.size_min
        status = ImageStatus.ACTIVE
        sort_dir = SortDirection.ASCENDING
        sort_key = 'name'
        tag = [rand_name('tag')]
        updated_at = datetime.now()
        user_id = random_string()
        visibility = ImageVisibility.SHARED

        data_dict = {'passing_additional_property':
                     {additional_property: additional_property_value},
                     'passing_auto_disk_config':
                     {'auto_disk_config': auto_disk_config},
                     'passing_checksum': {'checksum': checksum},
                     'passing_container_format':
                     {'container_format': container_format},
                     'passing_created_at': {'created_at': created_at},
                     'passing_disk_format': {'disk_format': disk_format},
                     'passing_id': {'id_': id_},
                     'passing_image_type': {'image_type': image_type},
                     'passing_limit': {'limit': limit},
                     'passing_marker': {'marker': marker},
                     'passing_member_status': {'member_status': member_status,
                                               'visibility': visibility},
                     'passing_min_disk': {'min_disk': min_disk},
                     'passing_min_ram': {'min_ram': min_ram},
                     'passing_name': {'name': name},
                     'passing_no_parameters': {},
                     'passing_os_type': {'os_type': os_type},
                     'passing_owner': {'owner': owner},
                     'passing_protected': {'protected': protected},
                     'passing_size': {'size': size},
                     'passing_size_max': {'size_max': size_max},
                     'passing_size_min': {'size_min': size_min},
                     'passing_sort_dir': {'sort_dir': sort_dir},
                     'passing_sort_key': {'sort_key': sort_key},
                     'passing_status': {'status': status},
                     'passing_tag': {'tag': tag},
                     'passing_updated_at': {'updated_at': updated_at},
                     'passing_user_id': {'user_id': user_id},
                     'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'params')
Exemple #9
0
    def ListImagesSmoke():
        """
        @summary: Generates a dataset list of parameters for the list images
        request for smoke tests

        @return: Dataset_list
        @rtype: DatasetList
        """

        additional_property = images.config.additional_property
        additional_property_value = images.config.additional_property_value
        auto_disk_config = 'False'
        checksum = random_string()
        container_format = ImageContainerFormat.AMI
        created_at = datetime.now()
        disk_format = ImageDiskFormat.RAW
        id_ = '00000000-0000-0000-0000-000000000000'
        image_type = ImageType.IMPORT
        limit = 10
        marker = None
        member_status = ImageMemberStatus.ACCEPTED
        min_disk = images.config.min_disk
        min_ram = images.config.min_ram
        name = rand_name('image')
        os_type = ImageOSType.LINUX
        owner = random_int(0, 999999)
        protected = False
        size = random_int(0, 9999999)
        size_max = images.config.size_max
        size_min = images.config.size_min
        status = ImageStatus.ACTIVE
        sort_dir = SortDirection.ASCENDING
        sort_key = 'name'
        tag = [rand_name('tag')]
        updated_at = datetime.now()
        user_id = random_string()
        visibility = ImageVisibility.SHARED

        data_dict = {'passing_additional_property':
                     {additional_property: additional_property_value},
                     'passing_auto_disk_config':
                     {'auto_disk_config': auto_disk_config},
                     'passing_checksum': {'checksum': checksum},
                     'passing_container_format':
                     {'container_format': container_format},
                     'passing_created_at': {'created_at': created_at},
                     'passing_disk_format': {'disk_format': disk_format},
                     'passing_id': {'id_': id_},
                     'passing_image_type': {'image_type': image_type},
                     'passing_limit': {'limit': limit},
                     'passing_marker': {'marker': marker},
                     'passing_member_status': {'member_status': member_status,
                                               'visibility': visibility},
                     'passing_min_disk': {'min_disk': min_disk},
                     'passing_min_ram': {'min_ram': min_ram},
                     'passing_name': {'name': name},
                     'passing_no_parameters': {},
                     'passing_os_type': {'os_type': os_type},
                     'passing_owner': {'owner': owner},
                     'passing_protected': {'protected': protected},
                     'passing_size': {'size': size},
                     'passing_size_max': {'size_max': size_max},
                     'passing_size_min': {'size_min': size_min},
                     'passing_sort_dir': {'sort_dir': sort_dir},
                     'passing_sort_key': {'sort_key': sort_key},
                     'passing_status': {'status': status},
                     'passing_tag': {'tag': tag},
                     'passing_updated_at': {'updated_at': updated_at},
                     'passing_user_id': {'user_id': user_id},
                     'passing_visibility': {'visibility': visibility}}

        return build_basic_dataset(data_dict, 'params')