Merge branch 'fix-key-case' into pu

This commit is contained in:
Kevin Morris 2021-10-05 01:38:18 -07:00
commit aac13cd123
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 8 additions and 12 deletions

View file

@ -17,6 +17,7 @@ def _get_parser():
defaults = os.environ.get('AUR_CONFIG_DEFAULTS', path + '.defaults') defaults = os.environ.get('AUR_CONFIG_DEFAULTS', path + '.defaults')
_parser = configparser.RawConfigParser() _parser = configparser.RawConfigParser()
_parser.optionxform = lambda option: option
if os.path.isfile(defaults): if os.path.isfile(defaults):
with open(defaults) as f: with open(defaults) as f:
_parser.read_file(f) _parser.read_file(f)
@ -48,7 +49,6 @@ def getint(section, option, fallback=None):
return _get_parser().getint(section, option, fallback=fallback) return _get_parser().getint(section, option, fallback=fallback)
def get_section(section_name): def get_section(section):
for section in _get_parser().sections(): if section in _get_parser().sections():
if section == section_name:
return _get_parser()[section] return _get_parser()[section]

View file

@ -166,10 +166,4 @@ def add_samesite_fields(response: Response, value: str):
def get_ssh_fingerprints(): def get_ssh_fingerprints():
fingerprints = {} return aurweb.config.get_section("fingerprints") or {}
fingerprint_section = aurweb.config.get_section("fingerprints")
if fingerprint_section:
fingerprints = {key: fingerprint_section[key] for key in fingerprint_section.keys()}
return fingerprints

View file

@ -96,7 +96,9 @@ def test_homepage_ssh_fingerprints(get_ssh_fingerprints_mock):
with client as request: with client as request:
response = request.get("/") response = request.get("/")
assert list(fingerprints.values())[0] in response.content.decode() for key, value in fingerprints.items():
assert key in response.content.decode()
assert value in response.content.decode()
assert 'The following SSH fingerprints are used for the AUR' in response.content.decode() assert 'The following SSH fingerprints are used for the AUR' in response.content.decode()