def __init__(self): super(NormalGroup, self).__init__( group={ "name": tstrings.random_groupname().encode('UTF-8'), "description": random_bytestring(alpha=True, numeric=True), }, rename={"name": tstrings.random_groupname().encode('UTF-8')}, container=tstrings.random_name(), )
def test_group_creation_set_single_letter_name_nestedGroup(udm): """Add nestedGroup with single letter name to groups/group during creation""" nestedGroup = udm.create_group(name=uts.random_groupname(1))[0] group = udm.create_group(nestedGroup=nestedGroup)[0] utils.verify_ldap_object(group, {'uniqueMember': [nestedGroup]})
def test_group_creation_recursion_set_memberOf_to_self(udm): """groups/group recursion due setting itself as memberOf during creation""" # bugs: [13008] group_name = uts.random_groupname() with pytest.raises(udm_test.UCSTestUDM_CreateUDMObjectFailed): udm.create_group(memberOf='cn=%s,cn=groups,%s' % (group_name, udm.LDAP_BASE))
def test_rename_a_group_which_contains_a_nestedGroup(udm): """Rename group/groups which contains a nested groups/group""" nested_group = udm.create_group()[0] group = udm.create_group(nestedGroup=nested_group)[0] new_group_name = uts.random_groupname() udm.modify_object('groups/group', dn=group, name=new_group_name) group = 'cn=%s,%s' % (new_group_name, ','.join(group.split(',')[1:])) utils.verify_ldap_object(group, {'uniqueMember': [nested_group]})
def test_rename_a_neasted_group(udm): """Rename a nested groups/group""" nested_group = udm.create_group()[0] group = udm.create_group(nestedGroup=nested_group)[0] wait_for_s4connector() new_nested_group_name = uts.random_groupname() udm.modify_object('groups/group', dn=nested_group, name=new_nested_group_name) wait_for_s4connector() nested_group = 'cn=%s,%s' % (new_nested_group_name, ','.join( nested_group.split(',')[1:])) utils.verify_ldap_object(group, {'uniqueMember': [nested_group]})
def test_group_creation_with_umlaut_in_name(udm): """Create groups/group with umlaut in name""" # bugs: [35521] # This test case is strange: Initially (2013) it should check that # the "gid" UDM syntax doesn't allow non-ASCII chracters. # But then, in 2014 Bug #35521 made a change to allow non-ASCII characters, # but that adjustment only had an effect for group names passed as unicode, # which probably is the case in case a UDM group is created via AD-Connector # So we have an inconsistent behavior here with PYthon2, Umlauts in group # names are allowed when passed as unicode, but, as the continued success of # this test case here shows, they apparently are not allowed, when passed # via udm-cli (probably as UTF-8 bytes). # # I set this test case to SKIP for now, because it didn't work any longer # for Python3 UDM, at the time of writing, as the value passed to the # "gid" UDM syntax is unicode now even when used from udm-cli. I don't think # we want to explicitly lower the bar again to the state of 2013. # Also I think it is more consistend to always allow Umlaut characters in # group names, not only when used from python, as done on the AD-Connector. # This should not be a problem since they are stored in LDAP as UTF-8. with pytest.raises(udm_test.UCSTestUDM_CreateUDMObjectFailed): udm.create_group(name='%säÄöÖüÜ%s' % (uts.random_groupname(4), uts.random_groupname(4)))[0]
def create_group(self, wait_for_replication=True, check_for_drs_replication=True, **kwargs): # :pylint: disable-msg=W0613 """ Creates a group via UDM CLI. Values for UDM properties can be passed via keyword arguments only and have to exactly match UDM property names (case-sensitive!). Some properties have default values: :param str position: `cn=users,$ldap_base` :param str name: <random value> :return: (dn, groupname) If "groupname" is missing, a random group name will be used. """ attr = self._set_module_default_attr(kwargs, (('position', 'cn=groups,%s' % self.LDAP_BASE), ('name', uts.random_groupname()))) return (self.create_object('groups/group', wait_for_replication, check_for_drs_replication, **attr), attr['name'])
def test_group_creation_with_single_letter_name(udm): """Create groups/group with single letter name""" group = udm.create_group(name=uts.random_groupname(1))[0] utils.verify_ldap_object(group)