Debian Codegraph @

tests/languages/rego/property_feature.test

raw
1 instances[instance] {
2 server := sites[_].servers[_]
3 instance := {"address": server.hostname, "name": server.name}
4 } {
5 container := containers[_]
6 instance := {"address": container.ipaddress, "name": container.name}
7 }
8
9 apps := [
10 {
11 "name": "web",
12 "servers": ["web-0", "web-1", "web-1000", "web-1001", "web-dev"]
13 },
14 {
15 "name": "mysql",
16 "servers": ["db-0", "db-1000"]
17 },
18 {
19 "name": "mongodb",
20 "servers": ["db-dev"]
21 }
22 ]
23
24 not allow with input as {"user": "charlie", "method": "GET"} with data.roles as {"dev": ["bob"]}
25
26 allow with input as {"user": "charlie", "method": "GET"} with data.roles as {"dev": ["charlie"]}
27
28 ----------------------------------------------------
29
30 [
31 "instances",
32 ["punctuation", "["],
33 "instance",
34 ["punctuation", "]"],
35 ["punctuation", "{"],
36
37 "\r\n server ",
38 ["operator", ":="],
39 " sites",
40 ["punctuation", "["],
41 ["operator", "_"],
42 ["punctuation", "]"],
43 ["punctuation", "."],
44 "servers",
45 ["punctuation", "["],
46 ["operator", "_"],
47 ["punctuation", "]"],
48
49 "\r\n instance ",
50 ["operator", ":="],
51 ["punctuation", "{"],
52 ["property", "\"address\""],
53 ["operator", ":"],
54 " server",
55 ["punctuation", "."],
56 "hostname",
57 ["punctuation", ","],
58 ["property", "\"name\""],
59 ["operator", ":"],
60 " server",
61 ["punctuation", "."],
62 "name",
63 ["punctuation", "}"],
64
65 ["punctuation", "}"],
66 ["punctuation", "{"],
67
68 "\r\n container ",
69 ["operator", ":="],
70 " containers",
71 ["punctuation", "["],
72 ["operator", "_"],
73 ["punctuation", "]"],
74
75 "\r\n instance ",
76 ["operator", ":="],
77 ["punctuation", "{"],
78 ["property", "\"address\""],
79 ["operator", ":"],
80 " container",
81 ["punctuation", "."],
82 "ipaddress",
83 ["punctuation", ","],
84 ["property", "\"name\""],
85 ["operator", ":"],
86 " container",
87 ["punctuation", "."],
88 "name",
89 ["punctuation", "}"],
90
91 ["punctuation", "}"],
92
93 "\r\n\r\napps ",
94 ["operator", ":="],
95 ["punctuation", "["],
96
97 ["punctuation", "{"],
98
99 ["property", "\"name\""],
100 ["operator", ":"],
101 ["string", "\"web\""],
102 ["punctuation", ","],
103
104 ["property", "\"servers\""],
105 ["operator", ":"],
106 ["punctuation", "["],
107 ["string", "\"web-0\""],
108 ["punctuation", ","],
109 ["string", "\"web-1\""],
110 ["punctuation", ","],
111 ["string", "\"web-1000\""],
112 ["punctuation", ","],
113 ["string", "\"web-1001\""],
114 ["punctuation", ","],
115 ["string", "\"web-dev\""],
116 ["punctuation", "]"],
117
118 ["punctuation", "}"],
119 ["punctuation", ","],
120
121 ["punctuation", "{"],
122
123 ["property", "\"name\""],
124 ["operator", ":"],
125 ["string", "\"mysql\""],
126 ["punctuation", ","],
127
128 ["property", "\"servers\""],
129 ["operator", ":"],
130 ["punctuation", "["],
131 ["string", "\"db-0\""],
132 ["punctuation", ","],
133 ["string", "\"db-1000\""],
134 ["punctuation", "]"],
135
136 ["punctuation", "}"],
137 ["punctuation", ","],
138
139 ["punctuation", "{"],
140
141 ["property", "\"name\""],
142 ["operator", ":"],
143 ["string", "\"mongodb\""],
144 ["punctuation", ","],
145
146 ["property", "\"servers\""],
147 ["operator", ":"],
148 ["punctuation", "["],
149 ["string", "\"db-dev\""],
150 ["punctuation", "]"],
151
152 ["punctuation", "}"],
153
154 ["punctuation", "]"],
155
156 ["keyword", "not"],
157 " allow ",
158 ["keyword", "with"],
159 " input ",
160 ["keyword", "as"],
161 ["punctuation", "{"],
162 ["property", "\"user\""],
163 ["operator", ":"],
164 ["string", "\"charlie\""],
165 ["punctuation", ","],
166 ["property", "\"method\""],
167 ["operator", ":"],
168 ["string", "\"GET\""],
169 ["punctuation", "}"],
170 ["keyword", "with"],
171 " data",
172 ["punctuation", "."],
173 "roles ",
174 ["keyword", "as"],
175 ["punctuation", "{"],
176 ["property", "\"dev\""],
177 ["operator", ":"],
178 ["punctuation", "["],
179 ["string", "\"bob\""],
180 ["punctuation", "]"],
181 ["punctuation", "}"],
182
183 "\r\n\r\nallow ",
184 ["keyword", "with"],
185 " input ",
186 ["keyword", "as"],
187 ["punctuation", "{"],
188 ["property", "\"user\""],
189 ["operator", ":"],
190 ["string", "\"charlie\""],
191 ["punctuation", ","],
192 ["property", "\"method\""],
193 ["operator", ":"],
194 ["string", "\"GET\""],
195 ["punctuation", "}"],
196 ["keyword", "with"],
197 " data",
198 ["punctuation", "."],
199 "roles ",
200 ["keyword", "as"],
201 ["punctuation", "{"],
202 ["property", "\"dev\""],
203 ["operator", ":"],
204 ["punctuation", "["],
205 ["string", "\"charlie\""],
206 ["punctuation", "]"],
207 ["punctuation", "}"]
208 ]