diff options
-rw-r--r-- | moonv4/tests/populate_default_values.py | 2 | ||||
-rw-r--r-- | moonv4/tests/utils/pdp.py | 8 | ||||
-rw-r--r-- | moonv4/tests/utils/policies.py | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/moonv4/tests/populate_default_values.py b/moonv4/tests/populate_default_values.py index cd06ab1a..fa099458 100644 --- a/moonv4/tests/populate_default_values.py +++ b/moonv4/tests/populate_default_values.py @@ -32,7 +32,7 @@ requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.WARNING) requests_log.propagate = True -logger = logging.getLogger(__name__) +logger = logging.getLogger("moonforming") if args.filename: print("Loading: {}".format(args.filename[0])) diff --git a/moonv4/tests/utils/pdp.py b/moonv4/tests/utils/pdp.py index 4f513aa6..f3c6df37 100644 --- a/moonv4/tests/utils/pdp.py +++ b/moonv4/tests/utils/pdp.py @@ -1,7 +1,9 @@ +import logging import requests import utils.config config = utils.config.get_config_data() +logger = logging.getLogger("moonforming.utils.policies") URL = "http://{}:{}".format( config['components']['manager']['hostname'], @@ -15,7 +17,7 @@ KEYSTONE_SERVER = config['openstack']['keystone']['url'] pdp_template = { "name": "test_pdp", "security_pipeline": [], - "keystone_project_id": "", + "keystone_project_id": None, "description": "test", } @@ -46,6 +48,8 @@ def get_keystone_projects(): } req = requests.post("{}/auth/tokens".format(KEYSTONE_SERVER), json=data_auth, headers=HEADERS) + logger.debug("{}/auth/tokens".format(KEYSTONE_SERVER)) + logger.debug(req.text) assert req.status_code in (200, 201) TOKEN = req.headers['X-Subject-Token'] HEADERS['X-Auth-Token'] = TOKEN @@ -95,6 +99,8 @@ def add_pdp(name="test_pdp", policy_id=None): if policy_id: pdp_template['security_pipeline'].append(policy_id) req = requests.post(URL + "/pdp", json=pdp_template, headers=HEADERS) + logger.debug(req.status_code) + logger.debug(req) assert req.status_code == 200 result = req.json() assert type(result) is dict diff --git a/moonv4/tests/utils/policies.py b/moonv4/tests/utils/policies.py index df7f5f57..bd08291a 100644 --- a/moonv4/tests/utils/policies.py +++ b/moonv4/tests/utils/policies.py @@ -1,7 +1,9 @@ +import logging import requests import utils.config config = utils.config.get_config_data() +logger = logging.getLogger("moonforming.utils.policies") URL = "http://{}:{}".format(config['components']['manager']['hostname'], config['components']['manager']['port']) URL = URL + "{}" @@ -108,10 +110,13 @@ def delete_policy(policy_id): def add_subject(policy_id=None, name="test_subject"): subject_template['name'] = name if policy_id: + logger.debug(URL.format("/policies/{}/subjects".format(policy_id))) req = requests.post(URL.format("/policies/{}/subjects".format(policy_id)), json=subject_template, headers=HEADERS) else: + logger.debug(URL.format("/subjects")) req = requests.post(URL.format("/subjects"), json=subject_template, headers=HEADERS) + logger.debug(req.text) assert req.status_code == 200 result = req.json() assert "subjects" in result |