def test_add_remove_user(ldap_conn, blank_rfc2307): """Test user addition and removal are reflected by SSSD""" e = ldap_ent.user(ldap_conn.ds_inst.base_dn, "user", 2001, 2000) time.sleep(INTERACTIVE_TIMEOUT/2) # Add the user ent.assert_passwd(ent.contains_only()) ldap_conn.add_s(*e) time.sleep(INTERACTIVE_TIMEOUT) ent.assert_passwd(ent.contains_only(dict(name="user", uid=2001))) # Remove the user ldap_conn.delete_s(e[0]) time.sleep(INTERACTIVE_TIMEOUT) ent.assert_passwd(ent.contains_only())
def test_add_remove_user(ldap_conn, blank_rfc2307): """Test user addition and removal are reflected by SSSD""" e = ldap_ent.user(ldap_conn.ds_inst.base_dn, "user", 2001, 2000) time.sleep(INTERACTIVE_TIMEOUT / 2) # Add the user ent.assert_passwd(ent.contains_only()) ldap_conn.add_s(*e) time.sleep(INTERACTIVE_TIMEOUT) ent.assert_passwd(ent.contains_only(dict(name="user", uid=2001))) # Remove the user ldap_conn.delete_s(e[0]) time.sleep(INTERACTIVE_TIMEOUT) ent.assert_passwd(ent.contains_only())
def test_user_2307bis_delete_user(ldap_conn, ldb_examine, setup_rfc2307bis): """ Test that deleting a user removes it from both caches """ ldb_conn = ldb_examine old_sysdb_attrs, old_ts_attrs = prime_cache_user(ldb_conn, "user1", 2001) e = ldap_ent.user(ldap_conn.ds_inst.base_dn, "user1", 1001, 2001) ldap_conn.delete_s(e[0]) # wait for slapd to change its database time.sleep(1) with pytest.raises(KeyError): pwd.getpwnam("user1") sysdb_attrs, ts_attrs = get_user_attrs(ldb_conn, "user1", 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
def test_user_2307bis_delete_user(ldap_conn, ldb_examine, setup_rfc2307bis): """ Test that deleting a user removes it from both caches """ ldb_conn = ldb_examine old_sysdb_attrs, old_ts_attrs = prime_cache_user(ldb_conn, "user1", 2001) e = ldap_ent.user(ldap_conn.ds_inst.base_dn, "user1", 1001, 2001) ldap_conn.delete_s(e[0]) # wait for slapd to change its database time.sleep(1) with pytest.raises(KeyError): pwd.getpwnam("user1") sysdb_attrs, ts_attrs = get_user_attrs(ldb_conn, "user1", 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