aboutsummaryrefslogtreecommitdiffstats
path: root/python_moonclient/tests/unit_python/conf/conf_objects.py
diff options
context:
space:
mode:
authorfrancois.cellier <francois.cellier@orange.com>2018-02-12 11:21:47 +0100
committerfrancois.cellier <francois.cellier@orange.com>2018-02-16 13:56:56 +0100
commit4bf344a003f550369511e5c3600b2600101cc8b7 (patch)
tree6ee1a5b74cf14df49e90b0967503f48d94fa6e7a /python_moonclient/tests/unit_python/conf/conf_objects.py
parent9da7ac6718d66b73ba7fc8fc70e656a70e4db766 (diff)
Use cliff for the moonclient cli
Change-Id: I85f9fe24037a3bd28ed069667e5e0c7fe482c2a7
Diffstat (limited to 'python_moonclient/tests/unit_python/conf/conf_objects.py')
-rw-r--r--python_moonclient/tests/unit_python/conf/conf_objects.py112
1 files changed, 112 insertions, 0 deletions
diff --git a/python_moonclient/tests/unit_python/conf/conf_objects.py b/python_moonclient/tests/unit_python/conf/conf_objects.py
new file mode 100644
index 00000000..cf3e7aa4
--- /dev/null
+++ b/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
+ )