Beispiel #1
0
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)
Beispiel #2
0
def teardown_function(function):

    assert tmp_backup_directory_is_empty()

    reset_ssowat_conf()
    delete_all_backups()
    uninstall_test_apps_if_needed()

    markers = {
        m.name: {
            'args': m.args,
            'kwargs': m.kwargs
        }
        for m in function.__dict__.get("pytestmark", [])
    }

    if "clean_opt_dir" in markers:
        shutil.rmtree("/opt/test_backup_output_directory")

    if "alice" in user_list()["users"]:
        user_delete("alice")

    if "with_custom_domain" in markers:
        domain = markers['with_custom_domain']['args'][0]
        domain_remove(domain)
Beispiel #3
0
def test_del_user(mocker):

    with message(mocker, "user_deleted"):
        user_delete("alice")

    group_res = user_group_list()["groups"]
    assert "alice" not in user_list()
    assert "alice" not in group_res
    assert "alice" not in group_res["all_users"]["members"]
Beispiel #4
0
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
Beispiel #5
0
def test_del_user_that_does_not_exist(mocker):
    with raiseYunohostError(mocker, "user_unknown"):
        user_delete("doesnt_exist")