# Path: ingenico/connect/sdk/response_header.py
# def get_header(headers, header_name):
#     """
#     :return: The header with the given name as a tuple with the name and
#      value, or None if there was no such header.
#     """
#     if headers is None:
#         return None
#     for name, value in headers.items():
#         if name.lower() == header_name.lower():
#             return name, value
#     return None
# 
# def get_header_value(headers, header_name):
#     """
#     :return: The value of the header with the given name, or None if there
#      was no such header.
#     """
#     if headers is None:
#         return None
#     for name, value in headers.items():
#         if name.lower() == header_name.lower():
#             return value
#     return None
# 
# def get_disposition_filename(headers):
#     """
#     :return: The value of the filename parameter of the Content-Disposition
#      header, or None if there was no such header or parameter.
#     """
#     header_value = get_header_value(headers, "Content-Disposition")
#     if header_value is None:
#         return None
#     pattern = re.compile(
#         "(?:^|;)\\s*filename\\s*=\\s*(.*?)\\s*(?:;|$)", re.IGNORECASE)
#     match = pattern.search(header_value)
#     if match is not None:
#         filename = match.group(1)
#         return __trim_quotes(filename)
#     return None


import unittest
from ingenico.connect.sdk.response_header import get_header, get_header_value, get_disposition_filename
        test_data["attachment; filename=\"testfile\""] = "testfile"
        test_data["attachment; filename=\"testfile"] = "\"testfile"
        test_data["attachment; filename=testfile\""] = "testfile\""
        test_data["attachment; filename='testfile'"] = "testfile"
        test_data["attachment; filename='testfile"] = "'testfile"
        test_data["attachment; filename=testfile'"] = "testfile'"

        test_data["filename=testfile"] = "testfile"
        test_data["filename=\"testfile\""] = "testfile"
        test_data["filename=\"testfile"] = "\"testfile"
        test_data["filename=testfile\""] = "testfile\""
        test_data["filename='testfile'"] = "testfile"
        test_data["filename='testfile"] = "'testfile"
        test_data["filename=testfile'"] = "testfile'"

        test_data["attachment; filename=testfile; x=y"] = "testfile"
        test_data["attachment; filename=\"testfile\"; x=y"] = "testfile"
        test_data["attachment; filename=\"testfile; x=y"] = "\"testfile"
        test_data["attachment; filename=testfile\"; x=y"] = "testfile\""
        test_data["attachment; filename='testfile'; x=y"] = "testfile"
        test_data["attachment; filename='testfile; x=y"] = "'testfile"
        test_data["attachment; filename=testfile'; x=y"] = "testfile'"

        test_data["attachment"] = None

        test_data["filename=\""] = "\""
        test_data["filename='"] = "'"

        for value, expected in test_data.items():
            headers = {"Content-Disposition": value}

# Path: ingenico/connect/sdk/response_header.py
# def get_header(headers, header_name):
#     """
#     :return: The header with the given name as a tuple with the name and
#      value, or None if there was no such header.
#     """
#     if headers is None:
#         return None
#     for name, value in headers.items():
#         if name.lower() == header_name.lower():
#             return name, value
#     return None
# 
# def get_header_value(headers, header_name):
#     """
#     :return: The value of the header with the given name, or None if there
#      was no such header.
#     """
#     if headers is None:
#         return None
#     for name, value in headers.items():
#         if name.lower() == header_name.lower():
#             return value
#     return None
# 
# def get_disposition_filename(headers):
#     """
#     :return: The value of the filename parameter of the Content-Disposition
#      header, or None if there was no such header or parameter.
#     """
#     header_value = get_header_value(headers, "Content-Disposition")
#     if header_value is None:
#         return None
#     pattern = re.compile(
#         "(?:^|;)\\s*filename\\s*=\\s*(.*?)\\s*(?:;|$)", re.IGNORECASE)
#     match = pattern.search(header_value)
#     if match is not None:
#         filename = match.group(1)
#         return __trim_quotes(filename)
#     return None


# Path: tests/unit/test_response_header.py
import unittest
from ingenico.connect.sdk.response_header import get_header, get_header_value, get_disposition_filename

        test_data["attachment; filename=\"testfile\""] = "testfile"
        test_data["attachment; filename=\"testfile"] = "\"testfile"
        test_data["attachment; filename=testfile\""] = "testfile\""
        test_data["attachment; filename='testfile'"] = "testfile"
        test_data["attachment; filename='testfile"] = "'testfile"
        test_data["attachment; filename=testfile'"] = "testfile'"

        test_data["filename=testfile"] = "testfile"
        test_data["filename=\"testfile\""] = "testfile"
        test_data["filename=\"testfile"] = "\"testfile"
        test_data["filename=testfile\""] = "testfile\""
        test_data["filename='testfile'"] = "testfile"
        test_data["filename='testfile"] = "'testfile"
        test_data["filename=testfile'"] = "testfile'"

        test_data["attachment; filename=testfile; x=y"] = "testfile"
        test_data["attachment; filename=\"testfile\"; x=y"] = "testfile"
        test_data["attachment; filename=\"testfile; x=y"] = "\"testfile"
        test_data["attachment; filename=testfile\"; x=y"] = "testfile\""
        test_data["attachment; filename='testfile'; x=y"] = "testfile"
        test_data["attachment; filename='testfile; x=y"] = "'testfile"
        test_data["attachment; filename=testfile'; x=y"] = "testfile'"

        test_data["attachment"] = None

        test_data["filename=\""] = "\""
        test_data["filename='"] = "'"

        for value, expected in test_data.items():
            headers = {"Content-Disposition": value}

            self.assertEqual(expected, get_disposition_filename(headers))