Revision 3e3db819
vigigraph: correction des TU
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@6812 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/controllers/rpc.py | ||
---|---|---|
473 | 473 |
break |
474 | 474 |
# Sinon, l'utilisateur n'a pas accès à ce groupe |
475 | 475 |
else: |
476 |
return dict(groups = [], leaves = [])
|
|
476 |
return dict(groups = [], items = [])
|
|
477 | 477 |
|
478 | 478 |
limit = int(config.get("max_menu_entries", 20)) |
479 | 479 |
result = {"groups": [], "items": []} |
... | ... | |
695 | 695 |
'type' : "group", |
696 | 696 |
}) |
697 | 697 |
|
698 |
return dict(groups=groups, leaves=[])
|
|
698 |
return dict(groups=groups, items=[])
|
|
699 | 699 |
|
700 | 700 |
def getListIndicators(self, host, graph): |
701 | 701 |
""" |
vigigraph/tests/functional/test_graph_selection_form.py | ||
---|---|---|
129 | 129 |
# de graphes retournée contient bien 'graphgroup1' |
130 | 130 |
self.assertEqual( |
131 | 131 |
json, { |
132 |
'leaves': [], |
|
133 |
'groups': [{'id': graphgroup1.idgroup, 'name': graphgroup1.name}] |
|
132 |
'items': [], |
|
133 |
'groups': [{'id': graphgroup1.idgroup, |
|
134 |
'name': graphgroup1.name, |
|
135 |
'type': 'group'}] |
|
134 | 136 |
} |
135 | 137 |
) |
136 | 138 |
|
... | ... | |
145 | 147 |
# de graphes retournée contient bien 'graphgroup2' |
146 | 148 |
self.assertEqual( |
147 | 149 |
json, { |
148 |
'leaves': [], |
|
149 |
'groups': [{'id': graphgroup2.idgroup, 'name': graphgroup2.name}] |
|
150 |
'items': [], |
|
151 |
'groups': [{'id': graphgroup2.idgroup, |
|
152 |
'name': graphgroup2.name, |
|
153 |
'type': 'group'}] |
|
150 | 154 |
} |
151 | 155 |
) |
152 | 156 |
|
... | ... | |
161 | 165 |
# de graphes retournée contient bien 'graphgroup1' |
162 | 166 |
self.assertEqual( |
163 | 167 |
json, { |
164 |
'leaves': [], |
|
165 |
'groups': [{'id': graphgroup1.idgroup, 'name': graphgroup1.name}] |
|
168 |
'items': [], |
|
169 |
'groups': [{'id': graphgroup1.idgroup, |
|
170 |
'name': graphgroup1.name, |
|
171 |
'type': 'group'}] |
|
166 | 172 |
} |
167 | 173 |
) |
168 | 174 |
|
... | ... | |
177 | 183 |
# de graphes retournée contient bien 'graphgroup2' |
178 | 184 |
self.assertEqual( |
179 | 185 |
json, { |
180 |
'leaves': [], |
|
181 |
'groups': [{'id': graphgroup2.idgroup, 'name': graphgroup2.name}] |
|
186 |
'items': [], |
|
187 |
'groups': [{'id': graphgroup2.idgroup, |
|
188 |
'name': graphgroup2.name, |
|
189 |
'type': 'group'}] |
|
182 | 190 |
} |
183 | 191 |
) |
184 | 192 |
|
... | ... | |
193 | 201 |
# de graphes retournée contient bien 'graphgroup2' |
194 | 202 |
self.assertEqual( |
195 | 203 |
json, { |
196 |
'leaves': [], |
|
197 |
'groups': [{'id': graphgroup2.idgroup, 'name': graphgroup2.name}] |
|
204 |
'items': [], |
|
205 |
'groups': [{'id': graphgroup2.idgroup, |
|
206 |
'name': graphgroup2.name, |
|
207 |
'type': 'group'}] |
|
198 | 208 |
} |
199 | 209 |
) |
200 | 210 |
|
... | ... | |
209 | 219 |
# de graphes retournée contient bien 'graphgroup3' |
210 | 220 |
self.assertEqual( |
211 | 221 |
json, { |
212 |
'leaves': [], |
|
213 |
'groups': [{'id': graphgroup3.idgroup, 'name': graphgroup3.name}] |
|
222 |
'items': [], |
|
223 |
'groups': [{'id': graphgroup3.idgroup, |
|
224 |
'name': graphgroup3.name, |
|
225 |
'type': 'group'}] |
|
214 | 226 |
} |
215 | 227 |
) |
216 | 228 |
|
... | ... | |
373 | 385 |
# graphes retournée contient 'graph1' |
374 | 386 |
self.assertEqual( |
375 | 387 |
json, { |
376 |
'leaves': [{'id': graph1.idgraph, 'name': graph1.name}], |
|
388 |
'items': [{'id': graph1.idgraph, |
|
389 |
'name': graph1.name, |
|
390 |
'type': 'item'}], |
|
377 | 391 |
'groups': [] |
378 | 392 |
} |
379 | 393 |
) |
... | ... | |
390 | 404 |
# graphes retournée contient 'graph2' |
391 | 405 |
self.assertEqual( |
392 | 406 |
json, { |
393 |
'leaves': [{'id': graph2.idgraph, 'name': graph2.name}], |
|
407 |
'items': [{'id': graph2.idgraph, |
|
408 |
'name': graph2.name, |
|
409 |
'type': 'item'}], |
|
394 | 410 |
'groups': [] |
395 | 411 |
} |
396 | 412 |
) |
... | ... | |
407 | 423 |
# graphes retournée contient 'graph1' |
408 | 424 |
self.assertEqual( |
409 | 425 |
json, { |
410 |
'leaves': [{'id': graph1.idgraph, 'name': graph1.name}], |
|
426 |
'items': [{'id': graph1.idgraph, |
|
427 |
'name': graph1.name, |
|
428 |
'type': 'item'}], |
|
411 | 429 |
'groups': [] |
412 | 430 |
} |
413 | 431 |
) |
... | ... | |
424 | 442 |
# graphes retournée contient 'graph2' |
425 | 443 |
self.assertEqual( |
426 | 444 |
json, { |
427 |
'leaves': [{'id': graph2.idgraph, 'name': graph2.name}], |
|
445 |
'items': [{'id': graph2.idgraph, |
|
446 |
'name': graph2.name, |
|
447 |
'type': 'item'}], |
|
428 | 448 |
'groups': [] |
429 | 449 |
} |
430 | 450 |
) |
... | ... | |
441 | 461 |
# graphes retournée contient 'graph2' |
442 | 462 |
self.assertEqual( |
443 | 463 |
json, { |
444 |
'leaves': [{'id': graph2.idgraph, 'name': graph2.name}], |
|
464 |
'items': [{'id': graph2.idgraph, |
|
465 |
'name': graph2.name, |
|
466 |
'type': 'item'}], |
|
445 | 467 |
'groups': [] |
446 | 468 |
} |
447 | 469 |
) |
... | ... | |
458 | 480 |
# graphes retournée contient 'graph3' |
459 | 481 |
self.assertEqual( |
460 | 482 |
json, { |
461 |
'leaves': [{'id': graph3.idgraph, 'name': graph3.name}], |
|
483 |
'items': [{'id': graph3.idgraph, |
|
484 |
'name': graph3.name, |
|
485 |
'type': 'item'}], |
|
462 | 486 |
'groups': [] |
463 | 487 |
} |
464 | 488 |
) |
vigigraph/tests/functional/test_host_selection_form.py | ||
---|---|---|
122 | 122 |
# d'hôtes retournée contient bien 'mhg' |
123 | 123 |
self.assertEqual( |
124 | 124 |
json, { |
125 |
'leaves': [], 'groups': [{
|
|
125 |
'items': [], 'groups': [{
|
|
126 | 126 |
'id': mainhostgroup.idgroup, |
127 |
'name': mainhostgroup.name |
|
127 |
'name': mainhostgroup.name, |
|
128 |
'type': 'group', |
|
128 | 129 |
}] |
129 | 130 |
} |
130 | 131 |
) |
... | ... | |
151 | 152 |
# d'hôtes retournée contient bien 'mhg' |
152 | 153 |
self.assertEqual( |
153 | 154 |
json, { |
154 |
'leaves': [], 'groups': [{
|
|
155 |
'items': [], 'groups': [{
|
|
155 | 156 |
'id': mainhostgroup.idgroup, |
156 |
'name': mainhostgroup.name |
|
157 |
'name': mainhostgroup.name, |
|
158 |
'type': 'group', |
|
157 | 159 |
}] |
158 | 160 |
} |
159 | 161 |
) |
... | ... | |
181 | 183 |
# d'hôtes retournée contient bien 'mhg' |
182 | 184 |
self.assertEqual( |
183 | 185 |
json, { |
184 |
'leaves': [], 'groups': [{
|
|
186 |
'items': [], 'groups': [{
|
|
185 | 187 |
'id': mainhostgroup.idgroup, |
186 |
'name': mainhostgroup.name |
|
188 |
'name': mainhostgroup.name, |
|
189 |
'type': 'group', |
|
187 | 190 |
}] |
188 | 191 |
} |
189 | 192 |
) |
... | ... | |
205 | 208 |
|
206 | 209 |
# On s'assure que la liste de groupes d'hôtes retournée est bien vide |
207 | 210 |
self.assertEqual( |
208 |
json, {'leaves': [], 'groups': []}
|
|
211 |
json, {'items': [], 'groups': []}
|
|
209 | 212 |
) |
210 | 213 |
|
211 | 214 |
def test_get_main_host_groups_as_anonymous(self): |
... | ... | |
258 | 261 |
# contient bien 'No subgroup', 'hg1', et 'hg2' |
259 | 262 |
self.assertEqual( |
260 | 263 |
json, { |
261 |
'leaves': [
|
|
262 |
{'id': host1.idhost, 'name': host1.name} |
|
264 |
'items': [
|
|
265 |
{'id': host1.idhost, 'name': host1.name, 'type': 'item'}
|
|
263 | 266 |
], |
264 | 267 |
'groups': [ |
265 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name}, |
|
266 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name}, |
|
268 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name, 'type': 'group'},
|
|
269 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name, 'type': 'group'},
|
|
267 | 270 |
] |
268 | 271 |
} |
269 | 272 |
) |
... | ... | |
279 | 282 |
# contient bien 'No subgroup', 'hg1', et 'hg2' |
280 | 283 |
self.assertEqual( |
281 | 284 |
json, { |
282 |
'leaves': [
|
|
283 |
{'id': host1.idhost, 'name': host1.name} |
|
285 |
'items': [
|
|
286 |
{'id': host1.idhost, 'name': host1.name, 'type': 'item'}
|
|
284 | 287 |
], |
285 | 288 |
'groups': [ |
286 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name}, |
|
287 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name}, |
|
289 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name, 'type': 'group'},
|
|
290 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name, 'type': 'group'},
|
|
288 | 291 |
] |
289 | 292 |
} |
290 | 293 |
) |
... | ... | |
300 | 303 |
# d'hôtes retournée contient bien 'hg1' |
301 | 304 |
self.assertEqual( |
302 | 305 |
json, { |
303 |
'leaves': [],
|
|
306 |
'items': [],
|
|
304 | 307 |
'groups': [ |
305 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name}, |
|
308 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name, 'type': 'group'},
|
|
306 | 309 |
] |
307 | 310 |
} |
308 | 311 |
) |
... | ... | |
325 | 328 |
|
326 | 329 |
# On s'assure que la liste de groupes d'hôtes retournée est bien vide |
327 | 330 |
self.assertEqual( |
328 |
json, {'leaves': [], 'groups': []}
|
|
331 |
json, {'items': [], 'groups': []}
|
|
329 | 332 |
) |
330 | 333 |
|
331 | 334 |
def test_get_host_groups_as_anonymous(self): |
... | ... | |
358 | 361 |
|
359 | 362 |
# On s'assure que la liste de groupes d'hôtes retournée est bien vide |
360 | 363 |
self.assertEqual( |
361 |
json, {'leaves': [], 'groups': []}
|
|
364 |
json, {'items': [], 'groups': []}
|
|
362 | 365 |
) |
363 | 366 |
|
364 | 367 |
##### Troisième onglet déroulant du formulaire ##### |
... | ... | |
398 | 401 |
# On s'assure que la liste d'hôtes retournée contient bien 'host1' |
399 | 402 |
self.assertEqual( |
400 | 403 |
json, { |
401 |
'leaves': [{'id': host1.idhost, 'name': host1.name}],
|
|
404 |
'items': [{'id': host1.idhost, 'name': host1.name, 'type': 'item'}],
|
|
402 | 405 |
'groups': [ |
403 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name}, |
|
404 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name} |
|
406 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name, 'type': 'group'},
|
|
407 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name, 'type': 'group'}
|
|
405 | 408 |
] |
406 | 409 |
} |
407 | 410 |
) |
... | ... | |
416 | 419 |
# On s'assure que la liste d'hotes retournée contient bien 'host2' |
417 | 420 |
self.assertEqual( |
418 | 421 |
json, { |
419 |
'leaves': [{'id': host2.idhost, 'name': host2.name}],
|
|
422 |
'items': [{'id': host2.idhost, 'name': host2.name, 'type': 'item'}],
|
|
420 | 423 |
'groups': [] |
421 | 424 |
} |
422 | 425 |
) |
... | ... | |
431 | 434 |
# On s'assure que la liste d'hôtes retournée contient bien 'host1' |
432 | 435 |
self.assertEqual( |
433 | 436 |
json, { |
434 |
'leaves': [{'id': host1.idhost, 'name': host1.name}],
|
|
437 |
'items': [{'id': host1.idhost, 'name': host1.name, 'type': 'item'}],
|
|
435 | 438 |
'groups': [ |
436 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name}, |
|
437 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name}, |
|
439 |
{'id': hostgroup1.idgroup, 'name': hostgroup1.name, 'type': 'group'},
|
|
440 |
{'id': hostgroup2.idgroup, 'name': hostgroup2.name, 'type': 'group'},
|
|
438 | 441 |
] |
439 | 442 |
} |
440 | 443 |
) |
... | ... | |
449 | 452 |
# On s'assure que la liste d'hotes retournée contient bien 'host2' |
450 | 453 |
self.assertEqual( |
451 | 454 |
json, { |
452 |
'leaves': [{'id': host2.idhost, 'name': host2.name}],
|
|
455 |
'items': [{'id': host2.idhost, 'name': host2.name, 'type': 'item'}],
|
|
453 | 456 |
'groups': [] |
454 | 457 |
} |
455 | 458 |
) |
... | ... | |
464 | 467 |
# On s'assure que la liste d'hôtes retournée contient bien 'host2' |
465 | 468 |
self.assertEqual( |
466 | 469 |
json, { |
467 |
'leaves': [{'id': host2.idhost, 'name': host2.name}],
|
|
470 |
'items': [{'id': host2.idhost, 'name': host2.name, 'type': 'item'}],
|
|
468 | 471 |
'groups': [] |
469 | 472 |
} |
470 | 473 |
) |
... | ... | |
498 | 501 |
# On s'assure que la liste d'hôtes retournée est vide |
499 | 502 |
self.assertEqual( |
500 | 503 |
json, { |
501 |
'leaves': [],
|
|
502 |
'groups': [{'name': hostgroup1.name, 'id': hostgroup1.idgroup}] |
|
504 |
'items': [],
|
|
505 |
'groups': [{'name': hostgroup1.name, 'id': hostgroup1.idgroup, 'type': 'group'}]
|
|
503 | 506 |
} |
504 | 507 |
) |
505 | 508 |
|
... | ... | |
512 | 515 |
|
513 | 516 |
# On s'assure que la liste d'hôtes retournée est vide |
514 | 517 |
self.assertEqual( |
515 |
json, {'leaves': [], 'groups': []}
|
|
518 |
json, {'items': [], 'groups': []}
|
|
516 | 519 |
) |
517 | 520 |
|
518 | 521 |
# Récupération des hôtes du groupe 'mhg' |
... | ... | |
524 | 527 |
|
525 | 528 |
# On s'assure que la liste d'hôtes retournée est vide |
526 | 529 |
self.assertEqual( |
527 |
json, {'leaves': [], 'groups': []}
|
|
530 |
json, {'items': [], 'groups': []}
|
|
528 | 531 |
) |
529 | 532 |
|
530 | 533 |
# Récupération des hôtes du groupe 'hg1' |
... | ... | |
536 | 539 |
|
537 | 540 |
# On s'assure que la liste d'hôtes retournée est vide |
538 | 541 |
self.assertEqual( |
539 |
json, {'leaves': [], 'groups': []}
|
|
542 |
json, {'items': [], 'groups': []}
|
|
540 | 543 |
) |
541 | 544 |
|
542 | 545 |
def test_get_hosts_as_anonymous(self): |
... | ... | |
569 | 572 |
|
570 | 573 |
# On s'assure que la liste retournée est vide |
571 | 574 |
self.assertEqual( |
572 |
json, {'leaves': [], 'groups': []}
|
|
575 |
json, {'items': [], 'groups': []}
|
|
573 | 576 |
) |
Also available in: Unified diff