aboutsummaryrefslogtreecommitdiffstats
path: root/python_moondb/tests/unit_python/policies/mock_data.py
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
committerThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
commit7bb53c64da2dcf88894bfd31503accdd81498f3d (patch)
tree4310e12366818af27947b5e2c80cb162da93a4b5 /python_moondb/tests/unit_python/policies/mock_data.py
parentcbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff)
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com> Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'python_moondb/tests/unit_python/policies/mock_data.py')
-rw-r--r--python_moondb/tests/unit_python/policies/mock_data.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/python_moondb/tests/unit_python/policies/mock_data.py b/python_moondb/tests/unit_python/policies/mock_data.py
deleted file mode 100644
index 47fc9f9e..00000000
--- a/python_moondb/tests/unit_python/policies/mock_data.py
+++ /dev/null
@@ -1,74 +0,0 @@
-import helpers.model_helper as model_helper
-import helpers.meta_rule_helper as meta_rule_helper
-import helpers.policy_helper as policy_helper
-import helpers.category_helper as category_helper
-
-
-def create_meta_rule(meta_rule_name="meta_rule1", category_prefix=""):
- meta_rule_value = {
- "name": meta_rule_name,
- "algorithm": "name of the meta rule algorithm",
- "subject_categories": [category_prefix + "subject_category_id1",
- category_prefix + "subject_category_id2"],
- "object_categories": [category_prefix + "object_category_id1"],
- "action_categories": [category_prefix + "action_category_id1"]
- }
- return meta_rule_value
-
-
-def create_model(meta_rule_id, model_name="test_model"):
- value = {
- "name": model_name,
- "description": "test",
- "meta_rules": [meta_rule_id]
-
- }
- return value
-
-
-def create_policy(model_id, policy_name="policy_1"):
- value = {
- "name": policy_name,
- "model_id": model_id,
- "genre": "authz",
- "description": "test",
- }
- return value
-
-
-def create_pdp(pdp_ids):
- value = {
- "name": "test_pdp",
- "security_pipeline": pdp_ids,
- "keystone_project_id": "keystone_project_id1",
- "description": "...",
- }
- return value
-
-
-def get_policy_id(model_name="test_model", policy_name="policy_1", meta_rule_name="meta_rule1", category_prefix=""):
- category_helper.add_subject_category(
- category_prefix + "subject_category_id1",
- value={"name": category_prefix + "subject_category_id1",
- "description": "description 1"})
- category_helper.add_subject_category(
- category_prefix + "subject_category_id2",
- value={"name": category_prefix + "subject_category_id2",
- "description": "description 1"})
- category_helper.add_object_category(
- category_prefix + "object_category_id1",
- value={"name": category_prefix + "object_category_id1",
- "description": "description 1"})
- category_helper.add_action_category(
- category_prefix + "action_category_id1",
- value={"name": category_prefix + "action_category_id1",
- "description": "description 1"})
- meta_rule = meta_rule_helper.add_meta_rule(value=create_meta_rule(meta_rule_name, category_prefix))
- meta_rule_id = list(meta_rule.keys())[0]
- model = model_helper.add_model(value=create_model(meta_rule_id, model_name))
- model_id = list(model.keys())[0]
- value = create_policy(model_id, policy_name)
- policy = policy_helper.add_policies(value=value)
- assert policy
- policy_id = list(policy.keys())[0]
- return policy_id