blob: b2642979d568a5f383dcd56ad5ceaad9889fc98e (
plain)
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
|
def create_meta_rule():
meta_rule_value = {
"name": "meta_rule1",
"algorithm": "name of the meta rule algorithm",
"subject_categories": ["subject_category_id1",
"subject_category_id2"],
"object_categories": ["object_category_id1"],
"action_categories": ["action_category_id1"]
}
return meta_rule_value
def create_model(meta_rule_id):
value = {
"name": "test_model",
"description": "test",
"meta_rules": [meta_rule_id]
}
return value
def create_policy(model_id):
value = {
"name": "policy_1",
"model_id": model_id,
"genre": "authz",
"description": "test",
}
return value
def get_policy_id():
import policies.test_policies as test_policies
import models.test_models as test_models
import models.test_meta_rules as test_meta_rules
meta_rule = test_meta_rules.add_meta_rule(value=create_meta_rule())
meta_rule_id = list(meta_rule.keys())[0]
model = test_models.add_model(value=create_model(meta_rule_id))
model_id = list(model.keys())[0]
value = create_policy(model_id)
policy = test_policies.add_policies(value)
assert policy
policy_id = list(policy.keys())[0]
return policy_id
|