From 95bcb24cd7707ba62613aa8ec9ed5c3c79f2b7ec Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 17 Jun 2019 18:13:09 +0200 Subject: [PATCH 1/3] really retrieve XML encoding (#10196) --- mellon/utils.py | 8 +++++--- tests/test_sso_slo.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mellon/utils.py b/mellon/utils.py index 6462f81..009f043 100644 --- a/mellon/utils.py +++ b/mellon/utils.py @@ -254,13 +254,15 @@ def login(request, user): def get_xml_encoding(content): - xml_encoding = 'utf-8' + xml_encoding = ['utf-8'] + def xmlDeclHandler(version, encoding, standalone): - xml_encoding = encoding + if encoding: + xml_encoding[0] = encoding parser = expat.ParserCreate() parser.XmlDeclHandler = xmlDeclHandler parser.Parse(content, True) - return xml_encoding + return xml_encoding[0] def get_local_path(request, url): diff --git a/tests/test_sso_slo.py b/tests/test_sso_slo.py index 276c373..42ab8ef 100644 --- a/tests/test_sso_slo.py +++ b/tests/test_sso_slo.py @@ -115,7 +115,7 @@ class MockIdp(object): del self.artifact_message login.buildResponseMsg() assert 'rsa-sha256' in login.msgBody - return login.msgBody + return '\n' + login.msgBody def mock_artifact_resolver(self): @all_requests -- 2.20.1