Added some more logging info

This commit is contained in:
Roland Hedberg
2013-08-27 10:57:59 +02:00
parent 99e3302e67
commit 3e464015ec
2 changed files with 15 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ class Conversation(object):
:ivar response: The received HTTP messages
:ivar protocol_response: List of the received protocol messages
"""
def __init__(self, client, config, interaction,
check_factory=None, msg_factory=None,
features=None, verbose=False, expect_exception=None):
@@ -165,13 +165,17 @@ class Conversation(object):
_spec = self.interaction.pick_interaction(_base, content)
except InteractionNeeded:
self.position = url
cnt = content.replace("\n", '').replace("\t", '').replace("\r",
'')
logger.error("URL: %s" % url)
logger.error("Page Content: %s" % content)
logger.error("Page Content: %s" % cnt)
raise
except KeyError:
self.position = url
cnt = content.replace("\n", '').replace("\t", '').replace("\r",
'')
logger.error("URL: %s" % url)
logger.error("Page Content: %s" % content)
logger.error("Page Content: %s" % cnt)
self.err_check("interaction-needed")
if _spec == _last_action:
@@ -270,8 +274,10 @@ class Conversation(object):
try:
self.do_query()
except InteractionNeeded:
cnt = self.last_content.replace("\n", '').replace(
"\t", '').replace("\r", '')
self.test_output.append({"status": INTERACTION,
"message": self.last_content,
"message": cnt,
"id": "exception",
"name": "interaction needed",
"url": self.position})

View File

@@ -73,13 +73,15 @@ class Client(object):
self._parser.add_argument(
"-l", dest="list", action="store_true",
help="List all the test flows as a JSON object")
self._parser.add_argument("-c", dest="idpconfig", default="idp_conf",
self._parser.add_argument("-c", dest="config", default="config",
help="Configuration file for the IdP")
self._parser.add_argument(
"-P", dest="configpath", default=".",
help="Path to the configuration file for the IdP")
self._parser.add_argument("-t", dest="testpackage",
help="Module describing tests")
self._parser.add_argument("-Y", dest="pysamllog", action='store_true',
help="Print PySAML2 logs")
self._parser.add_argument("oper", nargs="?", help="Which test to run")
self.interactions = None
@@ -97,7 +99,7 @@ class Client(object):
def idp_configure(self, metadata_construction=False):
sys.path.insert(0, self.args.configpath)
mod = import_module(self.args.idpconfig)
mod = import_module(self.args.config)
self.idp_config = IdPConfig().load(mod.CONFIG, metadata_construction)
self.idp = Server(config=self.idp_config)
@@ -215,7 +217,7 @@ class Client(object):
self.idp_configure()
metadata = MetadataStore(SCHEMA, self.idp_config.attribute_converters,
self.idp_config.xmlsec_binary)
self.idp_config)
info = _jc["metadata"].encode("utf-8")
md = MetaData(SCHEMA, self.idp_config.attribute_converters, info)
md.load()