A multipurpose python flask API server and administration SPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
734 B

  1. from corvus.service.role_service import ROLES, Role
  2. def test_role_tree_find_roles_in_hierarchy():
  3. roles = ROLES.find_roles_in_hierarchy(Role.USER)
  4. assert len(roles) == 4
  5. assert Role.USER in roles
  6. assert Role.MODERATOR in roles
  7. assert Role.AUDITOR in roles
  8. assert Role.ADMIN in roles
  9. roles = ROLES.find_roles_in_hierarchy(Role.AUDITOR)
  10. assert len(roles) == 2
  11. assert Role.AUDITOR in roles
  12. assert Role.ADMIN in roles
  13. def test_role_tree_find_children_roles():
  14. roles = ROLES.find_children_roles(Role.USER)
  15. assert len(roles) == 2
  16. assert Role.USER in roles
  17. assert Role.ANONYMOUS in roles
  18. def test_role_tree_find_role_key_error():
  19. assert len(ROLES.find_role(Role.NONE)) == 0