aboutsummaryrefslogtreecommitdiffstats
path: root/old/python_moonclient/tests/unit_python/conf
diff options
context:
space:
mode:
Diffstat (limited to 'old/python_moonclient/tests/unit_python/conf')
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_action_assignments.py51
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_action_categories.py32
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_action_data.py66
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_actions.py111
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_all.py1
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_meta_rules.py44
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_models.py94
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_object_assignments.py51
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_object_categories.py31
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_object_data.py67
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_objects.py112
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_pdps.py95
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_policies.py78
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_projects.py44
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_rules.py46
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_subject_assignments.py51
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_subject_categories.py30
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_subject_data.py67
-rw-r--r--old/python_moonclient/tests/unit_python/conf/conf_subjects.py112
19 files changed, 1183 insertions, 0 deletions
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_action_assignments.py b/old/python_moonclient/tests/unit_python/conf/conf_action_assignments.py
new file mode 100644
index 00000000..43c4db59
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_action_assignments.py
@@ -0,0 +1,51 @@
+from .conf_all import *
+
+POST_ACTION_ASSIGNMENT = {
+ "action_assignments":{
+ "1":{
+ "policy_id": "1",
+ "action_id": "2",
+ "category_id": "1",
+ "assignments": ["1"]
+ }
+ }
+}
+
+POST_OTHER_ACTION_ASSIGNMENT = {
+ "action_assignments":{
+ "2":{
+ "policy_id": "1",
+ "action_id": "2",
+ "category_id": "1",
+ "assignments": ["2"]
+ }
+ }
+}
+
+DELETE_ACTION_ASSIGNMENT = {
+ "action_assignments":{
+
+ }
+}
+
+
+def conf_action_assignments(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/action_assignments/2/1/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_ACTION_ASSIGNMENT},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_ACTION_ASSIGNMENT}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/action_assignments/2/1/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OTHER_ACTION_ASSIGNMENT
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/action_assignments',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_ACTION_ASSIGNMENT
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/action_assignments/2/1/1',
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_action_categories.py b/old/python_moonclient/tests/unit_python/conf/conf_action_categories.py
new file mode 100644
index 00000000..909befb2
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_action_categories.py
@@ -0,0 +1,32 @@
+
+
+ACTION_CATEGORIES = {
+ "action_categories": {
+ "1": {
+ "name": "action_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+POST_ACTION_CATEGORIES = {
+ "action_categories": {
+ "1": {
+ "name": "action_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+
+def conf_action_categories(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/action_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=ACTION_CATEGORIES
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/action_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_ACTION_CATEGORIES
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_action_data.py b/old/python_moonclient/tests/unit_python/conf/conf_action_data.py
new file mode 100644
index 00000000..fb6f501c
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_action_data.py
@@ -0,0 +1,66 @@
+from .conf_all import *
+
+ACTION_DATA = {
+ "action_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }]
+}
+
+POST_ACTION_DATA = {
+ "action_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+POST_OTHER_ACTION_DATA = {
+ "action_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "2": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+DELETE_ACTION_DATA= {
+ "action_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data":{}
+ }]
+}
+
+
+def conf_action_data(m):
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/action_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_ACTION_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': POST_OTHER_ACTION_DATA}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/action_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': ACTION_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_ACTION_DATA}]
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/action_data/1/1',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_actions.py b/old/python_moonclient/tests/unit_python/conf/conf_actions.py
new file mode 100644
index 00000000..4e6784dd
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_actions.py
@@ -0,0 +1,111 @@
+from .conf_all import *
+
+ACTIONS = {
+ "actions":{
+ "1": {
+ "name": "name of the action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ }
+ }
+}
+
+ACTIONS_AFTER_POST = {
+ "actions":{
+ "1": {
+ "name": "name of the action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+ACTIONS_AFTER_PATCH = {
+ "actions":{
+ "1": {
+ "name": "name of the action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+
+POST_ACTIONS = {
+ "actions":{
+ "2": {
+ "name": "test_action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+PATCH_ACTIONS = {
+ "actions":{
+ "2": {
+ "name": "test_action",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+def conf_actions(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/actions',
+ headers={'X-Subject-Token': "111111111"},
+ json=ACTIONS
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/actions',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_ACTIONS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/actions/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/policies/2/actions/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_ACTIONS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/actions',
+ headers={'X-Subject-Token': "111111111"},
+ json=ACTIONS_AFTER_PATCH
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/actions',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_ACTIONS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/actions/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_ACTIONS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/actions/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_all.py b/old/python_moonclient/tests/unit_python/conf/conf_all.py
new file mode 100644
index 00000000..b87d4fe7
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_all.py
@@ -0,0 +1 @@
+RESULT_OK = {"result": "OK"}
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_meta_rules.py b/old/python_moonclient/tests/unit_python/conf/conf_meta_rules.py
new file mode 100644
index 00000000..67c14ddf
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_meta_rules.py
@@ -0,0 +1,44 @@
+from .conf_all import *
+
+
+META_RULES = {
+ "meta_rules": {
+ "1": {
+ "name": "test_meta_rule",
+ "algorithm": "name of the meta rule algorithm",
+ "subject_categories": ["1"],
+ "object_categories": ["1"],
+ "action_categories": ["1"]
+ }
+ }
+}
+
+POST_META_RULES = {
+ "meta_rules": {
+ "1": {
+ "name": "test_meta_rule",
+ "algorithm": "name of the meta rule algorithm",
+ "subject_categories": ["1"],
+ "object_categories": ["1"],
+ "action_categories": ["1"]
+ }
+ }
+}
+
+
+def conf_meta_rules(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/meta_rules',
+ headers={'X-Subject-Token': "111111111"},
+ json=META_RULES
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/meta_rules',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_META_RULES
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/meta_rules/1',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_models.py b/old/python_moonclient/tests/unit_python/conf/conf_models.py
new file mode 100644
index 00000000..930af88f
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_models.py
@@ -0,0 +1,94 @@
+from .conf_all import *
+
+
+MODELS = {
+ "models": {
+ "1": {
+ "name": "model 1",
+ "description": "description model 1",
+ "meta_rules": [{
+ "meta_rule_id": "1"
+ }, {
+ "meta_rule_id": "2"
+ }]
+ },
+ "2": {
+ "name": "model 2",
+ "description": "description model 2",
+ "meta_rules": ["2"]
+ },
+ "3": {
+ "name": "test_model",
+ "description": "description model 3",
+ "meta_rules": ["2"]
+ }
+ }
+}
+
+POST_MODEL = {
+ "models": {
+ "3": {
+ "name": "test_model",
+ "description": "description model 3",
+ "meta_rules": ["2"]
+ }
+ }
+}
+
+PATCH_MODEL = {
+ "models": {
+ "3": {
+ "name": "test_model",
+ "description": "description model 3",
+ "meta_rules": ["2", "1"]
+ }
+ }
+}
+
+
+MODELS_AFTER_POST = {
+"models": {
+ "1": {
+ "name": "model 1",
+ "description": "description model 1",
+ "meta_rules": [{
+ "meta_rule_id": "1"
+ }, {
+ "meta_rule_id": "2"
+ }]
+ },
+ "2": {
+ "name": "model 2",
+ "description": "description model 2",
+ "meta_rules": ["2"]
+ },
+ "3": {
+ "name": "test_model",
+ "description": "description model 3",
+ "meta_rules": ["1", "2"]
+ }
+ }
+}
+
+
+def conf_models(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/models',
+ [{'json': MODELS, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': MODELS_AFTER_POST, 'headers': {'X-Subject-Token': "111111111"}}]
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/models',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_MODEL
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/models/3',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_MODEL
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/models/3',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_object_assignments.py b/old/python_moonclient/tests/unit_python/conf/conf_object_assignments.py
new file mode 100644
index 00000000..9e88e03e
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_object_assignments.py
@@ -0,0 +1,51 @@
+from .conf_all import *
+
+POST_OBJECT_ASSIGNMENT = {
+ "object_assignments":{
+ "1":{
+ "policy_id": "1",
+ "object_id": "2",
+ "category_id": "1",
+ "assignments": ["1"]
+ }
+ }
+}
+
+POST_OTHER_OBJECT_ASSIGNMENT = {
+ "object_assignments":{
+ "2":{
+ "policy_id": "1",
+ "object_id": "2",
+ "category_id": "1",
+ "assignments": ["2"]
+ }
+ }
+}
+
+DELETE_OBJECT_ASSIGNMENT = {
+ "object_assignments":{
+
+ }
+}
+
+
+def conf_object_assignments(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/object_assignments/2/1/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_OBJECT_ASSIGNMENT},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_OBJECT_ASSIGNMENT}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/object_assignments/2/1/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OTHER_OBJECT_ASSIGNMENT
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/object_assignments',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OBJECT_ASSIGNMENT
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/object_assignments/2/1/1',
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_object_categories.py b/old/python_moonclient/tests/unit_python/conf/conf_object_categories.py
new file mode 100644
index 00000000..a942f9c6
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_object_categories.py
@@ -0,0 +1,31 @@
+
+OBJECT_CATEGORIES = {
+ "object_categories": {
+ "1": {
+ "name": "object_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+POST_OBJECT_CATEGORIES = {
+ "object_categories": {
+ "1": {
+ "name": "object_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+
+def conf_object_categories(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/object_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=OBJECT_CATEGORIES
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/object_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OBJECT_CATEGORIES
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_object_data.py b/old/python_moonclient/tests/unit_python/conf/conf_object_data.py
new file mode 100644
index 00000000..8fa81d69
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_object_data.py
@@ -0,0 +1,67 @@
+
+from .conf_all import *
+
+OBJECT_DATA = {
+ "object_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }]
+}
+
+POST_OBJECT_DATA = {
+ "object_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+POST_OTHER_OBJECT_DATA = {
+ "object_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "2": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+DELETE_OBJECT_DATA= {
+ "object_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data":{}
+ }]
+}
+
+
+def conf_object_data(m):
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/object_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_OBJECT_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': POST_OTHER_OBJECT_DATA}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/object_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': OBJECT_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_OBJECT_DATA}]
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/object_data/1/1',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_objects.py b/old/python_moonclient/tests/unit_python/conf/conf_objects.py
new file mode 100644
index 00000000..cf3e7aa4
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_objects.py
@@ -0,0 +1,112 @@
+from .conf_all import *
+
+OBJECTS = {
+ "objects":{
+ "1": {
+ "name": "name of the object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ }
+ }
+}
+
+OBJECTS_AFTER_POST = {
+ "objects":{
+ "1": {
+ "name": "name of the object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+OBJECTS_AFTER_PATCH = {
+ "objects":{
+ "1": {
+ "name": "name of the object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+
+POST_OBJECTS = {
+ "objects":{
+ "2": {
+ "name": "test_object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+PATCH_OBJECTS = {
+ "objects":{
+ "2": {
+ "name": "test_object",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+def conf_objects(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/objects',
+ [{'json': OBJECTS, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': OBJECTS_AFTER_POST, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': OBJECTS, 'headers': {'X-Subject-Token': "111111111"}}]
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/objects',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OBJECTS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/objects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/policies/2/objects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_OBJECTS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/objects',
+ headers={'X-Subject-Token': "111111111"},
+ json=OBJECTS_AFTER_PATCH
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/objects',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OBJECTS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/objects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_OBJECTS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/objects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_pdps.py b/old/python_moonclient/tests/unit_python/conf/conf_pdps.py
new file mode 100644
index 00000000..1090fccb
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_pdps.py
@@ -0,0 +1,95 @@
+from .conf_all import *
+
+PDPS = {
+ "pdps": {
+ "1": {
+ "name": "...",
+ "security_pipeline": [],
+ "keystone_project_id": "",
+ "description": "...",
+ }
+ }
+ }
+
+
+POST_PDP = {
+ "pdps": {
+ "2": {
+ "name": "test_pdp",
+ "security_pipeline": [],
+ "keystone_project_id": "",
+ "description": "..."
+ }
+ }
+ }
+
+PATCH_PDP = {
+ "pdps": {
+ "2": {
+ "name": "test_pdp",
+ "security_pipeline": [],
+ "keystone_project_id": "0c4e939acacf4376bdcd1129f1a054ad",
+ "description": "..."
+ }
+ }
+ }
+
+PDPS_AFTER_POST = {
+ "pdps": {
+ "1": {
+ "name": "...",
+ "security_pipeline": [],
+ "keystone_project_id": "",
+ "description": "...",
+ },
+
+ "2": {
+ "name": "test_pdp",
+ "security_pipeline": [],
+ "keystone_project_id": "",
+ "description": "...",
+ }
+ }
+ }
+
+PDPS_AFTER_PATCH = {
+ "pdps": {
+ "1": {
+ "name": "...",
+ "security_pipeline": [],
+ "keystone_project_id": "",
+ "description": "...",
+ },
+
+ "2": {
+ "name": "test_pdp",
+ "security_pipeline": [],
+ "keystone_project_id": "0c4e939acacf4376bdcd1129f1a054ad",
+ "description": "...",
+ }
+ }
+ }
+
+def conf_pdps(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/pdp',
+ [{'json': PDPS, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': PDPS_AFTER_POST, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': PDPS_AFTER_PATCH, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': PDPS, 'headers': {'X-Subject-Token': "111111111"}}]
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/pdp',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_PDP
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/pdp/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_PDP
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/pdp/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_policies.py b/old/python_moonclient/tests/unit_python/conf/conf_policies.py
new file mode 100644
index 00000000..bf6883bc
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_policies.py
@@ -0,0 +1,78 @@
+from .conf_all import *
+
+POLICIES = {
+ "policies":{
+ "1": {
+ "name": "test_policy",
+ "model_id": "1",
+ "genre": "authz",
+ "description": "Description of the policy",
+ }
+ }
+}
+
+POLICIES_AFTER_POST= {
+ "policies":{
+ "1": {
+ "name": "test_policy",
+ "model_id": "1",
+ "genre": "authz",
+ "description": "Description of the policy",
+ },
+ "2": {
+ "name": "test_policy",
+ "model_id": "",
+ "genre": "",
+ "description": "Description of the policy",
+ }
+ }
+}
+
+
+POST_POLICIES ={
+ "policies":{
+ "2": {
+ "name": "test_policy",
+ "model_id": "",
+ "genre": "",
+ "description": "Description of the policy",
+ }
+ }
+}
+
+
+PATCH_POLICIES ={
+ "policies":{
+ "2": {
+ "name": "test_policy",
+ "model_id": "3",
+ "genre": "authz",
+ "description": "Description of the policy",
+ }
+ }
+}
+
+
+def conf_policies(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies',
+ [{'json': POLICIES, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': POLICIES_AFTER_POST, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': POLICIES, 'headers': {'X-Subject-Token': "111111111"}}]
+
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_POLICIES
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/policies/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_POLICIES
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_projects.py b/old/python_moonclient/tests/unit_python/conf/conf_projects.py
new file mode 100644
index 00000000..63be05e0
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_projects.py
@@ -0,0 +1,44 @@
+
+
+PROJECTS = {
+ "projects": [
+ {
+ "is_domain": False,
+ "description": None,
+ "domain_id": "admin",
+ "enabled": True,
+ "id": "0c4e939acacf4376bdcd1129f1a054ad",
+ "links": {
+ "self": "http://example.com/identity/v3/projects/0c4e939acacf4376bdcd1129f1a054ad"
+ },
+ "name": "admin",
+ "parent_id": None,
+ "tags": []
+ },
+ {
+ "is_domain": False,
+ "description": None,
+ "domain_id": "default",
+ "enabled": True,
+ "id": "0cbd49cbf76d405d9c86562e1d579bd3",
+ "links": {
+ "self": "http://example.com/identity/v3/projects/0cbd49cbf76d405d9c86562e1d579bd3"
+ },
+ "name": "demo",
+ "parent_id": None,
+ "tags": []
+ }
+ ]
+}
+
+
+def conf_projects(m):
+ m.register_uri(
+ 'GET', 'http://keystone:5000/v3/projects',
+ headers={'X-Subject-Token': "111111111"},
+ json=PROJECTS
+ )
+ m.register_uri(
+ 'POST', 'http://keystone:5000/v3/auth/tokens',
+ headers={'X-Subject-Token': "111111111"}
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_rules.py b/old/python_moonclient/tests/unit_python/conf/conf_rules.py
new file mode 100644
index 00000000..30b8c682
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_rules.py
@@ -0,0 +1,46 @@
+from .conf_all import *
+
+RULES = {
+ "rules":{
+ "policy_id": "2",
+ "rules": [{
+ "meta_rule_id": "1",
+ "id": "1",
+ "rule": ["1", "1", "1"]
+ }]
+ }
+}
+
+POST_RULES = {
+ "rules":{
+ "1":{
+ "policy_id": "2",
+ "meta_rule_id": "1",
+ "rule": ["1", "1", "1"]
+ }
+ }
+}
+
+DELETE_RULES = {
+ "rules":{
+ "policy_id": "2",
+ "rules": []
+ }
+}
+
+
+def conf_rule_assignments(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/rules',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': RULES},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_RULES}]
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/rules',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_RULES}]
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/rules/1',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_subject_assignments.py b/old/python_moonclient/tests/unit_python/conf/conf_subject_assignments.py
new file mode 100644
index 00000000..92b689c0
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_subject_assignments.py
@@ -0,0 +1,51 @@
+from .conf_all import *
+
+POST_SUBJECT_ASSIGNMENT = {
+ "subject_assignments":{
+ "1":{
+ "policy_id": "1",
+ "subject_id": "2",
+ "category_id": "1",
+ "assignments": ["1"]
+ }
+ }
+}
+
+DELETE_SUBJECT_ASSIGNMENT = {
+ "subject_assignments":{
+
+ }
+}
+
+POST_OTHER_SUBJECT_ASSIGNMENT = {
+ "subject_assignments":{
+ "2":{
+ "policy_id": "1",
+ "subject_id": "2",
+ "category_id": "1",
+ "assignments": ["2"]
+ }
+ }
+}
+
+
+def conf_subject_assignments(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/subject_assignments/2/1/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_SUBJECT_ASSIGNMENT},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_SUBJECT_ASSIGNMENT}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/subject_assignments/2/1/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_OTHER_SUBJECT_ASSIGNMENT
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/subject_assignments',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_SUBJECT_ASSIGNMENT
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/subject_assignments/2/1/1',
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_subject_categories.py b/old/python_moonclient/tests/unit_python/conf/conf_subject_categories.py
new file mode 100644
index 00000000..e59a458a
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_subject_categories.py
@@ -0,0 +1,30 @@
+
+SUBJECT_CATEGORIES = {
+ "subject_categories": {
+ "1": {
+ "name": "subject_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+POST_SUBJECT_CATEGORIES = {
+ "subject_categories": {
+ "1": {
+ "name": "subject_cat_1",
+ "description": "description of the category"
+ }
+ }
+}
+
+def conf_subject_categories(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/subject_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=SUBJECT_CATEGORIES
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/subject_categories',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_SUBJECT_CATEGORIES
+ )
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_subject_data.py b/old/python_moonclient/tests/unit_python/conf/conf_subject_data.py
new file mode 100644
index 00000000..19db217d
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_subject_data.py
@@ -0,0 +1,67 @@
+from .conf_all import *
+
+SUBJECT_DATA = {
+ "subject_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }]
+}
+
+POST_SUBJECT_DATA = {
+ "subject_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "1": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+
+POST_OTHER_SUBJECT_DATA = {
+ "subject_data":{
+ "policy_id": "1",
+ "category_id": "1",
+ "data": {
+ "2": {
+ "name": "name of the data",
+ "description": "description of the data"
+ }
+ }
+ }
+}
+
+DELETE_SUBJECT_DATA= {
+ "subject_data":[{
+ "policy_id": "1",
+ "category_id": "1",
+ "data":{}
+ }]
+}
+
+
+def conf_subject_data(m):
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/subject_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': POST_SUBJECT_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': POST_OTHER_SUBJECT_DATA}]
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/subject_data/1',
+ [{'headers': {'X-Subject-Token': "111111111"}, 'json': SUBJECT_DATA},
+ {'headers': {'X-Subject-Token': "111111111"}, 'json': DELETE_SUBJECT_DATA}]
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/subject_data/1/1',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file
diff --git a/old/python_moonclient/tests/unit_python/conf/conf_subjects.py b/old/python_moonclient/tests/unit_python/conf/conf_subjects.py
new file mode 100644
index 00000000..bde6093f
--- /dev/null
+++ b/old/python_moonclient/tests/unit_python/conf/conf_subjects.py
@@ -0,0 +1,112 @@
+from .conf_all import *
+
+SUBJECTS = {
+ "subjects":{
+ "1": {
+ "name": "name of the subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ }
+ }
+}
+
+SUBJECTS_AFTER_POST= {
+ "subjects":{
+ "1": {
+ "name": "name of the subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+SUBJECTS_AFTER_PATCH= {
+ "subjects":{
+ "1": {
+ "name": "name of the subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["1"]
+ },
+ "2": {
+ "name": "test_subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+POST_SUBJECTS = {
+ "subjects":{
+ "2": {
+ "name": "test_subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": []
+ }
+ }
+}
+
+
+PATCH_SUBJECTS = {
+ "subjects":{
+ "2": {
+ "name": "test_subject",
+ "keystone_id": "1",
+ "description": "a description",
+ "policy_list": ["2"]
+ }
+ }
+}
+
+def conf_subjects(m):
+ m.register_uri(
+ 'GET', 'http://manager:30001/subjects',
+ [{'json': SUBJECTS, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': SUBJECTS_AFTER_POST, 'headers': {'X-Subject-Token': "111111111"}},
+ {'json': SUBJECTS, 'headers': {'X-Subject-Token': "111111111"}}]
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/subjects',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_SUBJECTS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/subjects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ )
+ m.register_uri(
+ 'PATCH', 'http://manager:30001/policies/2/subjects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_SUBJECTS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/subjects',
+ headers={'X-Subject-Token': "111111111"},
+ json=SUBJECTS_AFTER_PATCH
+ )
+ m.register_uri(
+ 'POST', 'http://manager:30001/policies/2/subjects',
+ headers={'X-Subject-Token': "111111111"},
+ json=POST_SUBJECTS
+ )
+ m.register_uri(
+ 'GET', 'http://manager:30001/policies/2/subjects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=PATCH_SUBJECTS
+ )
+ m.register_uri(
+ 'DELETE', 'http://manager:30001/policies/2/subjects/2',
+ headers={'X-Subject-Token': "111111111"},
+ json=RESULT_OK
+ ) \ No newline at end of file