aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/tests/utils/policies.py
diff options
context:
space:
mode:
Diffstat (limited to 'moonv4/tests/utils/policies.py')
-rw-r--r--moonv4/tests/utils/policies.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/moonv4/tests/utils/policies.py b/moonv4/tests/utils/policies.py
index bd08291a..fd4d238f 100644
--- a/moonv4/tests/utils/policies.py
+++ b/moonv4/tests/utils/policies.py
@@ -2,13 +2,10 @@ 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 + "{}"
-HEADERS = {"content-type": "application/json"}
+URL = None
+HEADERS = None
FILE = open("/tmp/test.log", "w")
+logger = logging.getLogger("utils.policies")
policy_template = {
"name": "test_policy",
@@ -56,6 +53,16 @@ subject_assignment_template = {
}
+def init(consul_host, consul_port):
+ conf_data = utils.config.get_config_data(consul_host, consul_port)
+ global URL, HEADERS
+ URL = "http://{}:{}".format(
+ conf_data['manager_host'],
+ conf_data['manager_port'])
+ URL = URL + "{}"
+ HEADERS = {"content-type": "application/json"}
+
+
def check_policy(policy_id=None):
req = requests.get(URL.format("/policies"))
assert req.status_code == 200