示例#1
0
    def create_one_image_member(attrs=None):
        """Create a fake image member.

        :param Dictionary attrs:
            A dictionary with all attributes of image member
        :return:
            A FakeResource object with member_id, image_id and so on
        """
        attrs = attrs or {}

        # Set default attribute
        image_member_info = {
            'member_id': 'member-id-' + uuid.uuid4().hex,
            'image_id': 'image-id-' + uuid.uuid4().hex,
            'status': 'pending',
        }

        # Overwrite default attributes if there are some attributes set
        image_member_info.update(attrs)

        return member.Member(**image_member_info)

        image_member = fakes.FakeModel(copy.deepcopy(image_member_info))

        return image_member
示例#2
0
    def create_one_endpoint_filter(attrs=None):
        """Create a fake endpoint project relationship.

        :param Dictionary attrs:
            A dictionary with all attributes of endpoint filter
        :return:
            A FakeResource object with project, endpoint and so on
        """
        attrs = attrs or {}

        # Set default attribute
        endpoint_filter_info = {
            'project': 'project-id-' + uuid.uuid4().hex,
            'endpoint': 'endpoint-id-' + uuid.uuid4().hex,
        }

        # Overwrite default attributes if there are some attributes set
        endpoint_filter_info.update(attrs)

        endpoint_filter = fakes.FakeModel(copy.deepcopy(endpoint_filter_info))

        return endpoint_filter