1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
)
|