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.

28 lines
796 B

  1. from server.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) == 5
  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. assert Role.OWNER in roles
  10. roles = ROLES.find_roles_in_hierarchy(Role.AUDITOR)
  11. assert len(roles) == 3
  12. assert Role.AUDITOR in roles
  13. assert Role.ADMIN in roles
  14. assert Role.OWNER in roles
  15. def test_role_tree_find_children_roles():
  16. roles = ROLES.find_children_roles(Role.USER)
  17. assert len(roles) == 2
  18. assert Role.USER in roles
  19. assert Role.ANONYMOUS in roles
  20. def test_role_tree_find_role_key_error():
  21. assert len(ROLES.find_role(Role.NONE)) == 0