Ejemplo n.º 1
0
def test_group_2307_delete_group(ldap_conn,
                                 ldb_examine,
                                 setup_rfc2307):
    """
    Test that deleting a group removes it from both caches
    """
    ldb_conn = ldb_examine
    old_sysdb_attrs, old_ts_attrs = prime_cache_group(
                                                ldb_conn, "group1",
                                                ("user1", "user11", "user21"))

    e = ldap_ent.group_bis(ldap_conn.ds_inst.base_dn, "group1", 2001)
    ldap_conn.delete_s(e[0])
    # wait for slapd to change its database
    time.sleep(1)

    with pytest.raises(KeyError):
        grp.getgrnam("group1")

    sysdb_attrs, ts_attrs = get_group_attrs(ldb_conn, "group1",
                                            SSSD_DOMAIN, TS_ATTRLIST)
    assert sysdb_attrs.get("dataExpireTimestamp") is None
    assert sysdb_attrs.get("originalModifyTimestamp") is None
    assert ts_attrs.get("dataExpireTimestamp") is None
    assert ts_attrs.get("originalModifyTimestamp") is None
Ejemplo n.º 2
0
def test_group_2307_delete_group(ldap_conn,
                                 ldb_examine,
                                 setup_rfc2307):
    """
    Test that deleting a group removes it from both caches
    """
    ldb_conn = ldb_examine
    old_sysdb_attrs, old_ts_attrs = prime_cache_group(
                                                ldb_conn, "group1",
                                                ("user1", "user11", "user21"))

    e = ldap_ent.group_bis(ldap_conn.ds_inst.base_dn, "group1", 2001)
    ldap_conn.delete_s(e[0])
    # wait for slapd to change its database
    time.sleep(1)

    with pytest.raises(KeyError):
        grp.getgrnam("group1")

    sysdb_attrs, ts_attrs = get_group_attrs(ldb_conn, "group1",
                                            SSSD_DOMAIN, TS_ATTRLIST)
    assert sysdb_attrs.get("dataExpireTimestamp") is None
    assert sysdb_attrs.get("originalModifyTimestamp") is None
    assert ts_attrs.get("dataExpireTimestamp") is None
    assert ts_attrs.get("originalModifyTimestamp") is None
Ejemplo n.º 3
0
def test_add_remove_group_rfc2307_bis(ldap_conn, blank_rfc2307_bis):
    """Test RFC2307bis group addition and removal are reflected by SSSD"""
    e = ldap_ent.group_bis(ldap_conn.ds_inst.base_dn, "group", 2001)
    time.sleep(INTERACTIVE_TIMEOUT/2)
    # Add the group
    ent.assert_group(ent.contains_only())
    ldap_conn.add_s(*e)
    time.sleep(INTERACTIVE_TIMEOUT)
    ent.assert_group(ent.contains_only(dict(name="group", gid=2001)))
    # Remove the group
    ldap_conn.delete_s(e[0])
    time.sleep(INTERACTIVE_TIMEOUT)
    ent.assert_group(ent.contains_only())
Ejemplo n.º 4
0
def test_add_remove_group_rfc2307_bis(ldap_conn, blank_rfc2307_bis):
    """Test RFC2307bis group addition and removal are reflected by SSSD"""
    e = ldap_ent.group_bis(ldap_conn.ds_inst.base_dn, "group", 2001)
    time.sleep(INTERACTIVE_TIMEOUT / 2)
    # Add the group
    ent.assert_group(ent.contains_only())
    ldap_conn.add_s(*e)
    time.sleep(INTERACTIVE_TIMEOUT)
    ent.assert_group(ent.contains_only(dict(name="group", gid=2001)))
    # Remove the group
    ldap_conn.delete_s(e[0])
    time.sleep(INTERACTIVE_TIMEOUT)
    ent.assert_group(ent.contains_only())