diff options
Diffstat (limited to 'moonv4/tests/utils/pdp.py')
-rw-r--r-- | moonv4/tests/utils/pdp.py | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/moonv4/tests/utils/pdp.py b/moonv4/tests/utils/pdp.py index f3c6df37..50998507 100644 --- a/moonv4/tests/utils/pdp.py +++ b/moonv4/tests/utils/pdp.py @@ -2,17 +2,16 @@ import logging import requests import utils.config -config = utils.config.get_config_data() logger = logging.getLogger("moonforming.utils.policies") +URL = None +HEADER = None +KEYSTONE_USER = None +KEYSTONE_PASSWORD = None +KEYSTONE_PROJECT = None +KEYSTONE_SERVER = None + +# config = utils.config.get_config_data() -URL = "http://{}:{}".format( - config['components']['manager']['hostname'], - config['components']['manager']['port']) -HEADERS = {"content-type": "application/json"} -KEYSTONE_USER = config['openstack']['keystone']['user'] -KEYSTONE_PASSWORD = config['openstack']['keystone']['password'] -KEYSTONE_PROJECT = config['openstack']['keystone']['project'] -KEYSTONE_SERVER = config['openstack']['keystone']['url'] pdp_template = { "name": "test_pdp", @@ -22,8 +21,22 @@ pdp_template = { } -def get_keystone_projects(): +def init(consul_host, consul_port): + conf_data = utils.config.get_config_data(consul_host, consul_port) + global URL, HEADER, KEYSTONE_USER, KEYSTONE_PASSWORD, KEYSTONE_PROJECT, KEYSTONE_SERVER + URL = "http://{}:{}".format( + conf_data['manager_host'], + conf_data['manager_port']) + # URL = URL + "{}" + HEADER = {"content-type": "application/json"} + KEYSTONE_USER = conf_data['keystone_user'] + KEYSTONE_PASSWORD = conf_data['keystone_password'] + KEYSTONE_PROJECT = conf_data['keystone_project'] + KEYSTONE_SERVER = conf_data['keystone_host'] + +def get_keystone_projects(): + global HEADERS HEADERS = { "Content-Type": "application/json" } @@ -160,4 +173,3 @@ def delete_pdp(pdp_id): assert type(result) is dict assert "result" in result assert result["result"] - |