Changeset View
Changeset View
Standalone View
Standalone View
tests/functional/test_wap_client/test_007_policy_uid.py
from ConfigParser import RawConfigParser | from ConfigParser import RawConfigParser | ||||
import time | import time | ||||
import unittest | import unittest | ||||
import pykolab | import pykolab | ||||
from pykolab import wap_client | from pykolab import wap_client | ||||
from pykolab.auth import Auth | from pykolab.auth import Auth | ||||
from pykolab.imap import IMAP | from pykolab.imap import IMAP | ||||
conf = pykolab.getConf() | conf = pykolab.getConf() | ||||
class TestPolicyUid(unittest.TestCase): | class TestPolicyUid(unittest.TestCase): | ||||
def remove_option(self, section, option): | def remove_option(self, section, option): | ||||
self.config.remove_option(section, option) | self.config.remove_option(section, option) | ||||
fp = open(conf.config_file, "w") | fp = open(conf.config_file, "w") | ||||
self.config.write(fp) | self.config.write(fp) | ||||
fp.close() | fp.close() | ||||
Show All 17 Lines | def setup_class(self, *args, **kw): | ||||
'local': 'john.doe', | 'local': 'john.doe', | ||||
'domain': 'example.org' | 'domain': 'example.org' | ||||
} | } | ||||
self.login = conf.get('ldap', 'bind_dn') | self.login = conf.get('ldap', 'bind_dn') | ||||
self.password = conf.get('ldap', 'bind_pw') | self.password = conf.get('ldap', 'bind_pw') | ||||
self.domain = conf.get('kolab', 'primary_domain') | self.domain = conf.get('kolab', 'primary_domain') | ||||
result = wap_client.authenticate(self.login, self.password, self.domain) | result = wap_client.authenticate(self.login, self.password, self.domain) | ||||
Lint: PEP8 E501: line too long (80 > 79 characters) | |||||
@classmethod | @classmethod | ||||
def teardown_class(self, *args, **kw): | def teardown_class(self, *args, **kw): | ||||
self.config.remove_option('example.org', 'policy_uid') | self.config.remove_option('example.org', 'policy_uid') | ||||
fp = open(conf.config_file, "w") | fp = open(conf.config_file, "w") | ||||
self.config.write(fp) | self.config.write(fp) | ||||
fp.close() | fp.close() | ||||
Show All 35 Lines | def test_002_givenname_dot_surname(self): | ||||
user_info = wap_client.user_info(user) | user_info = wap_client.user_info(user) | ||||
self.assertEqual(user_info['uid'], "John.Doe") | self.assertEqual(user_info['uid'], "John.Doe") | ||||
from tests.functional.purge_users import purge_users | from tests.functional.purge_users import purge_users | ||||
purge_users() | purge_users() | ||||
def test_003_givenname_fc_dot_surname(self): | def test_003_givenname_fc_dot_surname(self): | ||||
self.set('example.org', 'policy_uid', "'%(givenname)s'[0:1].%(surname)s") | self.set('example.org', 'policy_uid', "'%(givenname)s'[0:1].%(surname)s") | ||||
Lint: PEP8 E501 line too long (81 > 79 characters) Lint: PEP8 E501: line too long (81 > 79 characters) | |||||
from tests.functional.user_add import user_add | from tests.functional.user_add import user_add | ||||
user_add("John", "Doe") | user_add("John", "Doe") | ||||
from tests.functional.synchronize import synchronize_once | from tests.functional.synchronize import synchronize_once | ||||
synchronize_once() | synchronize_once() | ||||
auth = Auth() | auth = Auth() | ||||
auth.connect() | auth.connect() | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def test_005_lowercase_givenname(self): | ||||
user_info = wap_client.user_info(user) | user_info = wap_client.user_info(user) | ||||
self.assertEqual(user_info['uid'], "john") | self.assertEqual(user_info['uid'], "john") | ||||
from tests.functional.purge_users import purge_users | from tests.functional.purge_users import purge_users | ||||
purge_users() | purge_users() | ||||
def test_006_lowercase_givenname_surname(self): | def test_006_lowercase_givenname_surname(self): | ||||
self.set('example.org', 'policy_uid', "%(givenname)s.lower().%(surname)s.lower()") | self.set('example.org', 'policy_uid', "%(givenname)s.lower().%(surname)s.lower()") | ||||
Lint: PEP8 E501 line too long (90 > 79 characters) Lint: PEP8 E501: line too long (90 > 79 characters) | |||||
from tests.functional.user_add import user_add | from tests.functional.user_add import user_add | ||||
user_add("John", "Doe") | user_add("John", "Doe") | ||||
from tests.functional.synchronize import synchronize_once | from tests.functional.synchronize import synchronize_once | ||||
synchronize_once() | synchronize_once() | ||||
auth = Auth() | auth = Auth() | ||||
auth.connect() | auth.connect() | ||||
user = auth.find_recipient('john.doe@example.org') | user = auth.find_recipient('john.doe@example.org') | ||||
user_info = wap_client.user_info(user) | user_info = wap_client.user_info(user) | ||||
self.assertEqual(user_info['uid'], "john.doe") | self.assertEqual(user_info['uid'], "john.doe") | ||||
from tests.functional.purge_users import purge_users | from tests.functional.purge_users import purge_users | ||||
purge_users() | purge_users() | ||||
line too long (80 > 79 characters)