def clean_user_groups(): for u in user_list()["users"]: user_delete(u) for g in user_group_list()["groups"]: if g not in ["all_users", "visitors"]: user_group_delete(g)
def test_del_group(mocker): with message(mocker, "group_deleted", group="dev"): user_group_delete("dev") group_res = user_group_list()["groups"] assert "dev" not in group_res
def clean_user_groups_permission(): for u in user_list()['users']: user_delete(u) for g in user_group_list()['groups']: if g not in ["all_users", "visitors"]: user_group_delete(g) for p in user_permission_list()['permissions']: if any( p.startswith(name) for name in ["wiki", "blog", "site", "web", "permissions_app"]): permission_delete(p, force=True, sync_perm=False) socket.getaddrinfo = prv_getaddrinfo
def test_del_group_that_does_not_exist(mocker): with raiseYunohostError(mocker, "group_unknown"): user_group_delete("doesnt_exist")
def test_del_group_all_users(mocker): with raiseYunohostError(mocker, "group_cannot_be_deleted"): user_group_delete("all_users")