Commit 15ea6655 authored by Tatuya Kamada's avatar Tatuya Kamada

Fix the header section configuration format.

parent 1106f02e
...@@ -315,13 +315,13 @@ class HTTPCacheCheckerTestSuite(object): ...@@ -315,13 +315,13 @@ class HTTPCacheCheckerTestSuite(object):
re.MULTILINE | re.IGNORECASE) re.MULTILINE | re.IGNORECASE)
if content_type_regex.search(fetched_data) is not None: if content_type_regex.search(fetched_data) is not None:
for header, value in self.conditional_header_dict[section]: for header, value in self.conditional_header_dict[section]:
conditional_header_dict.setdefault(header, []).append(value) conditional_header_dict[header] = _formatConfiguration(value)
continue continue
if url_regex_str_match is not None: if url_regex_str_match is not None:
url_regex_str = url_regex_str_match.group(1) url_regex_str = url_regex_str_match.group(1)
if re.compile(url_regex_str).match(url) is not None: if re.compile(url_regex_str).match(url) is not None:
for header, value in self.conditional_header_dict[section]: for header, value in self.conditional_header_dict[section]:
conditional_header_dict.setdefault(header, []).append(value) conditional_header_dict[header] = _formatConfiguration(value)
return conditional_header_dict return conditional_header_dict
validator_dict = {} validator_dict = {}
...@@ -545,6 +545,12 @@ class HTTPCacheCheckerTestSuite(object): ...@@ -545,6 +545,12 @@ class HTTPCacheCheckerTestSuite(object):
from optparse import OptionParser from optparse import OptionParser
import ConfigParser import ConfigParser
def _formatConfiguration(configuration):
""" format the configuration"""
if configuration in ('True', 'true', 'yes'):
return True
return configuration.splitlines()
def web_checker_utility(): def web_checker_utility():
usage = "usage: %prog [options] config_path" usage = "usage: %prog [options] config_path"
parser = OptionParser(usage=usage) parser = OptionParser(usage=usage)
...@@ -577,10 +583,7 @@ def web_checker_utility(): ...@@ -577,10 +583,7 @@ def web_checker_utility():
# defaults are shared for all sections. # defaults are shared for all sections.
# so discard them from header_list # so discard them from header_list
continue continue
if configuration in ('True', 'true', 'yes'): value = _formatConfiguration(configuration)
value = True
else:
value = configuration.splitlines()
header_list[header] = value header_list[header] = value
conditional_header_dict = {} conditional_header_dict = {}
no_header_dict = {} no_header_dict = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment