41 |
41 |
def test_manager_login(superuser_or_admin, app):
|
42 |
42 |
manager_home_page = login(app, superuser_or_admin, reverse('a2-manager-homepage'))
|
43 |
43 |
|
44 |
|
sections = ['users', 'roles', 'ous']
|
45 |
|
no_sections = ['services']
|
46 |
|
if superuser_or_admin.is_superuser:
|
47 |
|
sections += no_sections
|
48 |
|
no_sections = []
|
|
44 |
sections = ['users', 'roles', 'ous', 'services']
|
49 |
45 |
|
50 |
46 |
for section in sections:
|
51 |
47 |
path = reverse('a2-manager-%s' % section)
|
52 |
48 |
assert manager_home_page.pyquery.remove_namespaces()('.apps a[href=\'%s\']' % path)
|
53 |
|
for section in no_sections:
|
54 |
|
path = reverse('a2-manager-%s' % section)
|
55 |
|
assert not manager_home_page.pyquery.remove_namespaces()('.apps a[href=\'%s\']' % path)
|
56 |
|
|
57 |
49 |
|
58 |
50 |
def test_manager_create_ou(superuser_or_admin, app):
|
59 |
51 |
ou_add = login(app, superuser_or_admin, path=reverse('a2-manager-ou-add'))
|
... | ... | |
332 |
324 |
form.set('search-internals', True)
|
333 |
325 |
response = form.submit()
|
334 |
326 |
q = response.pyquery.remove_namespaces()
|
335 |
|
assert len(q('table tbody tr')) == 5
|
|
327 |
assert len(q('table tbody tr')) == 6
|
336 |
328 |
# admin enroled only in the Manager role, other roles are inherited
|
337 |
|
assert len(q('table tbody tr td.via')) == 5
|
|
329 |
assert len(q('table tbody tr td.via')) == 6
|
338 |
330 |
assert len(q('table tbody tr td.via:empty')) == 2
|
339 |
331 |
for elt in q('table tbody td.name a'):
|
340 |
332 |
assert 'Manager' in elt.text or elt.text == 'simple role'
|
... | ... | |
349 |
341 |
response.form.set('search-internals', True)
|
350 |
342 |
response = response.form.submit()
|
351 |
343 |
q = response.pyquery.remove_namespaces()
|
352 |
|
assert len(q('table tbody tr')) == 5
|
|
344 |
assert len(q('table tbody tr')) == 6
|
353 |
345 |
for elt in q('table tbody td.name a'):
|
354 |
346 |
assert 'Manager' in elt.text or elt.text == u'simple role'
|
355 |
347 |
|
... | ... | |
401 |
393 |
form.set('search-internals', True)
|
402 |
394 |
response = form.submit()
|
403 |
395 |
q = response.pyquery.remove_namespaces()
|
404 |
|
assert len(q('table tbody tr')) == 4
|
|
396 |
assert len(q('table tbody tr')) == 5
|
405 |
397 |
# admin enroled only in the Manager role, other roles are inherited
|
406 |
|
assert len(q('table tbody tr td.via')) == 4
|
|
398 |
assert len(q('table tbody tr td.via')) == 5
|
407 |
399 |
assert len(q('table tbody tr td.via:empty')) == 1
|
408 |
400 |
for elt in q('table tbody td.name a'):
|
409 |
401 |
assert 'Manager' in elt.text
|
... | ... | |
413 |
405 |
form.set('search-internals', True)
|
414 |
406 |
response = form.submit()
|
415 |
407 |
q = response.pyquery.remove_namespaces()
|
416 |
|
assert len(q('table tbody tr')) == 6
|
|
408 |
assert len(q('table tbody tr')) == 7
|
417 |
409 |
for elt in q('table tbody td.name a'):
|
418 |
410 |
assert 'Manager' in elt.text
|
419 |
411 |
|
... | ... | |
437 |
429 |
response.form.set('search-internals', True)
|
438 |
430 |
response = response.form.submit()
|
439 |
431 |
q = response.pyquery.remove_namespaces()
|
440 |
|
assert len(q('table tbody tr')) == 12
|
|
432 |
assert len(q('table tbody tr')) == 15
|
441 |
433 |
for elt in q('table tbody td.name a'):
|
442 |
434 |
assert ('OU1' in elt.text or 'Default' in elt.text or 'Manager' in elt.text
|
443 |
435 |
or elt.text == u'simple role' or elt.text == u'role_ou1')
|
... | ... | |
446 |
438 |
response.form.set('search-internals', True)
|
447 |
439 |
response = response.form.submit()
|
448 |
440 |
q = response.pyquery.remove_namespaces()
|
449 |
|
assert len(q('table tbody tr')) == 6
|
|
441 |
assert len(q('table tbody tr')) == 7
|
450 |
442 |
for elt in q('table tbody td.name a'):
|
451 |
443 |
assert 'Manager' in elt.text
|
452 |
444 |
|
... | ... | |
493 |
485 |
response.form.set('search-internals', True)
|
494 |
486 |
response = response.form.submit()
|
495 |
487 |
q = response.pyquery.remove_namespaces()
|
496 |
|
assert len(q('table tbody tr')) == 3
|
|
488 |
assert len(q('table tbody tr')) == 4
|
497 |
489 |
names = {elt.text for elt in q('table tbody td.name a')}
|
498 |
|
assert names == {'Roles - OU1', 'Users - OU1', 'role_ou1'}
|
|
490 |
assert names == {'Roles - OU1', 'Users - OU1', 'Services - OU1', 'role_ou1'}
|
499 |
491 |
|
500 |
492 |
# test role listing
|
501 |
493 |
response = app.get('/manage/roles/')
|
... | ... | |
514 |
506 |
response.form.set('search-internals', True)
|
515 |
507 |
response = response.form.submit()
|
516 |
508 |
q = response.pyquery.remove_namespaces()
|
517 |
|
assert len(q('table tbody tr')) == 3
|
|
509 |
assert len(q('table tbody tr')) == 4
|
518 |
510 |
names = {elt.text for elt in q('table tbody td.name a')}
|
519 |
|
assert names == {'Roles - OU1', 'Users - OU1', 'role_ou1'}
|
|
511 |
assert names == {'Roles - OU1', 'Users - OU1', 'Services - OU1', 'role_ou1'}
|
520 |
512 |
|
521 |
513 |
test_user_listing_ou_admin(admin_ou1)
|
522 |
514 |
|
523 |
|
-
|