From 635281c970351414d0624b3e6efc1762b1188a3c Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 13 Jul 2016 17:26:03 +0200 Subject: [PATCH] intg: test nested membership Integration fes for #3093 --- src/tests/intg/test_ts_cache.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/tests/intg/test_ts_cache.py b/src/tests/intg/test_ts_cache.py index 0ba84b45f57ca246d28bfa0478a2c0db7e7a99e0..57c6264a6a6230bd6c56ce2b337bee9209f98572 100644 --- a/src/tests/intg/test_ts_cache.py +++ b/src/tests/intg/test_ts_cache.py @@ -130,6 +130,9 @@ def load_data_to_ldap(request, ldap_conn, schema): if schema == SCHEMA_RFC2307_BIS: ent_list.add_group_bis("group1", 2001, ("user1", "user11", "user21")) + ent_list.add_group_bis("group10", 2010, ["user1"]) + ent_list.add_group_bis("group11", 2011, ["user1"]) + ent_list.add_group_bis("group20", 2020, [], ["group10", "group11"]) elif schema == SCHEMA_RFC2307: ent_list.add_group("group1", 2001, ("user1", "user11", "user21")) create_ldap_fixture(request, ldap_conn, ent_list) @@ -605,3 +608,26 @@ def test_user_2307bis_delete_user(ldap_conn, 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_nested_groups(ldap_conn, + ldb_examine, + setup_rfc2307bis): + """ + Test nested groups + """ + primary_gid = 2001 + # group1, group10, group11, group20 + expected_gids = [ 2001, 2010, 2011, 2020 ] + + ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, + gid=primary_gid)) + + (res, errno, gids) = sssd_id.call_sssd_initgroups("user1", primary_gid) + assert res == sssd_id.NssReturnCode.SUCCESS + + assert sorted(gids) == sorted(expected_gids), \ + "result: %s\n expected %s" % ( + ", ".join(["%s" % s for s in sorted(gids)]), + ", ".join(["%s" % s for s in sorted(expected_gids)]) + ) -- 2.7.4