From 019b10d95976bb80bcce60ee93099b0fd57fcab5 Mon Sep 17 00:00:00 2001 From: asteroide Date: Mon, 15 May 2017 14:19:43 +0200 Subject: Update Moon engine to allow a session policy Change-Id: I63a80597710f08a6641e159cc2306d3cc68b1240 --- moonv4/moon_interface/tests/apitests/set_authz.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'moonv4/moon_interface/tests/apitests/set_authz.py') diff --git a/moonv4/moon_interface/tests/apitests/set_authz.py b/moonv4/moon_interface/tests/apitests/set_authz.py index 38b63509..f515e4eb 100644 --- a/moonv4/moon_interface/tests/apitests/set_authz.py +++ b/moonv4/moon_interface/tests/apitests/set_authz.py @@ -41,10 +41,13 @@ for rule in rules: url = "http://172.18.0.11:38001/authz/{}/{}".format(keystone_project_id, "/".join(rule)) req = requests.get(url) print("\033[1m{}\033[m {}".format(url, req.status_code)) - j = req.json() - # print(j) - if j.get("authz"): - print("\t\033[32m{}\033[m {}".format(j.get("authz"), j.get("error", ""))) + try: + j = req.json() + except Exception as e: + print(req.text) else: - print("\t\033[31m{}\033[m {}".format(j.get("authz"), j.get("error", ""))) + if j.get("authz"): + print("\t\033[32m{}\033[m {}".format(j.get("authz"), j.get("error", ""))) + else: + print("\t\033[31m{}\033[m {}".format(j.get("authz"), j.get("error", ""))) -- cgit 1.2.3-korg