Univention Bugzilla – Attachment 8444 Details for
Bug 43598
Write test cases for LDAP Filter / DN escaping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
test case
031_sync_special_usernames_in_ucs_py (text/plain), 2.62 KB, created by
Florian Best
on 2017-02-21 13:46:52 CET
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Florian Best
Created:
2017-02-21 13:46:52 CET
Size:
2.62 KB
patch
obsolete
>#!/usr/share/ucs-test/runner python ># -*- coding: utf-8 -*- >## desc: "Use a username with special characters in UCS" >## exposure: dangerous >## packages: >## - univention-s4-connector >## bugs: >## - 38614 > >from univention.testing.udm import UCSTestUDM >from univention.testing.strings import random_string >from univention.config_registry import ConfigRegistry;ucr=ConfigRegistry();ucr.load(); >from univention.testing.utils import get_ldap_connection >import univention.admin.objects >import univention.admin.uldap >import univention.admin.modules >univention.admin.modules.update() > >from s4connector import exit_if_connector_not_running, wait_for_sync > > >def verify_udm_object(module, dn, properties): > lo = get_ldap_connection() > po = univention.admin.uldap.position(lo.base) > obj = univention.admin.objects.get(univention.admin.modules.get(module), None, lo, po, dn) > obj.open() > for key, value in properties.items(): > assert obj.info.get(key) == value, '%s: %r != expected %r' % (key, obj.info.get(key), value) > > >def verify_samba_object(dn, attrs): > lo = univention.admin.uldap.access('%s.%s' % (ucr['hostname'], ucr['domainname']), 389, ucr['ldap/base'], 'CN=Administrator,cn=users,%s' % (ucr['ldap/base'],), 'univention') > obj = lo.get(dn) > for attr, value in attrs.iteritems(): > assert obj.get(attr) == value > > >exit_if_connector_not_running() > > >with UCSTestUDM() as udm: > username="%s'f.%%RWREöäü()+,:;_}{*" % (random_string(),) # $ > lastname="%s & Co" % (random_string(),) > > user = udm.create_user(username=username, lastname=lastname, description='univention', homeTelephoneNumber="123", wait_for_replication=False, check_for_drs_replication=False)[0] > print 'user=%r' % (user,) > assert user.startswith('uid=') > ad_user = 'CN=%s' % (user[4:],) > wait_for_sync() > > udm.modify_object('users/user', dn=user, organisation="Test", street="Street", city="Bremen", postcode="28359", mobileTelephoneNumber="3", pagerTelephoneNumber="4", sambaUserWorkstations="pc01", wait_for_replication=False, check_for_drs_replication=False) > wait_for_sync() > > verify_udm_object('users/user', user, { > "description": "univention", > "homeTelephoneNumber": ["123"], > "organisation": "Test", > "street": "Street", > "city": "Bremen", > "postcode": "28359", > "mobileTelephoneNumber": ["3"], > "pagerTelephoneNumber": ["4"], > "sambaUserWorkstations": ["pc01"], > }) > verify_samba_object(ad_user, { > "description": ["univention"], > "homePhone": ["123"], > "company": ["Test"], > "streetAddress": ["Street"], > "l": ["Bremen"], > "postalCode": ["28359"], > "mobile": ["3"], > "pager": ["4"], > "userWorkstations": ["pc01"], > }) > > udm.remove_object('users/user', dn=user) > # TODO: check if removed in AD
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43598
: 8444 |
8778