def test_001_two_johns(self): from tests.functional.user_add import user_add user_add("John", "Doe") user_add("John", "Doe") time.sleep(3) auth = Auth() auth.connect() max_tries = 20 while max_tries > 0: recipient1 = auth.find_recipient('*****@*****.**') recipient2 = auth.find_recipient('*****@*****.**') if not recipient1 or not recipient2: time.sleep(1) max_tries -= 1 else: break imap = IMAP() imap.connect() folders = imap.lm('user/[email protected]') self.assertEqual(len(folders), 1, "No INBOX found for first John") folders = imap.lm('user/[email protected]') self.assertEqual(len(folders), 1, "No INBOX found for second John")
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'john.doe', 'domain': 'example.org' } self.footer = {} footer_html_file = conf.get('wallace', 'footer_html') footer_text_file = conf.get('wallace', 'footer_text') if os.path.isfile(footer_text_file): self.footer['plain'] = open(footer_text_file, 'r').read() if not os.path.isfile(footer_html_file): self.footer['html'] = '<p>' + self.footer['plain'] + '</p>' else: self.footer['html'] = open(footer_html_file, 'r').read() self.send_to = '*****@*****.**' self.send_from = '*****@*****.**' self.message_to = '"Doe, John" <%s>' % (self.send_to) self.message_from = '"Doe, John" <%s>' % (self.send_from) from tests.functional.user_add import user_add user_add("John", "Doe") time.sleep(2) from tests.functional.synchronize import synchronize_once synchronize_once()
def test_002_user_recipient_policy_duplicate(self): from tests.functional.user_add import user_add user = { 'local': 'jane.doe', 'domain': 'example.org' } user_add("Jane", "Doe") time.sleep(3) auth = Auth() auth.connect() recipient = auth.find_recipient("%(local)s@%(domain)s" % (user)) if hasattr(self, 'assertIsInstance'): self.assertIsInstance(recipient, str) self.assertEqual(recipient, "uid=doe2,ou=People,dc=example,dc=org") result = wap_client.user_info(recipient) if not result.has_key('mailhost'): from tests.functional.synchronize import synchronize_once synchronize_once() result = wap_client.user_info(recipient) self.assertEqual(result['mail'], '*****@*****.**') self.assertEqual(result['alias'], ['*****@*****.**', '*****@*****.**'])
def test_002_user_recipient_policy_duplicate(self): from tests.functional.user_add import user_add user = {'local': 'jane.doe', 'domain': 'example.org'} user_add("Jane", "Doe") time.sleep(3) auth = Auth() auth.connect() recipient = auth.find_recipient("%(local)s@%(domain)s" % (user)) if hasattr(self, 'assertIsInstance'): self.assertIsInstance(recipient, str) self.assertEqual(recipient, "uid=doe2,ou=People,dc=example,dc=org") result = wap_client.user_info(recipient) if 'mailhost' not in result: from tests.functional.synchronize import synchronize_once synchronize_once() result = wap_client.user_info(recipient) self.assertEqual(result['mail'], '*****@*****.**') self.assertEqual(result['alias'], ['*****@*****.**', '*****@*****.**'])
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = {'local': 'john.doe', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("John", "Doe")
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = {'local': 'alvaro.fuentes', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("Álvaro", "Fuentes", 'es_ES') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = {'local': 'thomas.bruederli', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("Thomas", "Brüderli", 'de_CH') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = {'local': 'etienne-nicolas.mehul', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("Étienne-Nicolas", "Méhul", 'fr_FR') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'john.doe', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("John", "Doe")
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.john = {'local': 'john.doe', 'domain': 'example.org'} self.jane = {'local': 'jane.doe', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("John", "Doe") user_add("Jane", "Doe") from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'etienne-nicolas.mehul', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("Étienne-Nicolas", "Méhul", 'fr_FR') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'thomas.bruederli', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("Thomas", "Brüderli", 'de_CH') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'alvaro.fuentes', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("Álvaro", "Fuentes", 'es_ES') from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): conf.finalize_conf(fatal=False) self.login = conf.get('ldap', 'bind_dn') self.password = conf.get('ldap', 'bind_pw') self.domain = conf.get('kolab', 'primary_domain') self.user = { 'local': 'john.doe', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("John", "Doe")
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = {'local': 'john.doe', 'domain': 'example.org'} self.send_to = '*****@*****.**' self.send_from = '*****@*****.**' self.message_to = '"Doe, John" <%s>' % (self.send_to) self.message_from = '"Doe, John" <%s>' % (self.send_from) from tests.functional.user_add import user_add user_add("John", "Doe") time.sleep(2) from tests.functional.synchronize import synchronize_once synchronize_once()
def test_001_default(self): from tests.functional.user_add import user_add user_add("John", "Doe") from tests.functional.synchronize import synchronize_once synchronize_once() auth = Auth() auth.connect() user = auth.find_recipient('*****@*****.**') user_info = wap_client.user_info(user) self.assertEqual(user_info['uid'], "doe") from tests.functional.purge_users import purge_users purge_users()
def setup_class(self, *args, **kw): # set language to default pykolab.translate.setUserLanguage(conf.get('kolab','default_locale')) self.itip_reply_subject = _("Reservation Request for %(summary)s was %(status)s") from tests.functional.purge_users import purge_users purge_users() self.john = { 'displayname': 'John Doe', 'mail': '*****@*****.**', 'sender': 'John Doe <*****@*****.**>', 'mailbox': 'user/[email protected]', 'dn': 'uid=doe,ou=People,dc=example,dc=org' } self.jane = { 'displayname': 'Jane Manager', 'mail': '*****@*****.**', 'sender': 'Jane Manager <*****@*****.**>', 'mailbox': 'user/[email protected]', 'dn': 'uid=manager,ou=People,dc=example,dc=org' } from tests.functional.user_add import user_add user_add("John", "Doe") user_add("Jane", "Manager") funcs.purge_resources() self.audi = funcs.resource_add("car", "Audi A4") self.passat = funcs.resource_add("car", "VW Passat") self.boxter = funcs.resource_add("car", "Porsche Boxter S") self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ]) self.room1 = funcs.resource_add("confroom", "Room 101", owner=self.jane['dn'], kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY') self.room2 = funcs.resource_add("confroom", "Conference Room B-222") self.rooms = funcs.resource_add("collection", "Rooms", [ self.room1['dn'], self.room2['dn'] ], self.jane['dn'], kolabinvitationpolicy='ACT_ACCEPT_AND_NOTIFY') self.room3 = funcs.resource_add("confroom", "CEOs Office 303") self.viprooms = funcs.resource_add("collection", "VIP Rooms", [ self.room3['dn'] ], self.jane['dn'], kolabinvitationpolicy='ACT_MANUAL') time.sleep(1) from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.john = { 'local': 'john.doe', 'domain': 'example.org' } self.jane = { 'local': 'jane.doe', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("John", "Doe") user_add("Jane", "Doe") from tests.functional.synchronize import synchronize_once synchronize_once()
def setUp(self): from tests.functional.purge_users import purge_users purge_users() self.john = {'local': 'john.doe', 'domain': 'example.org'} from tests.functional.user_add import user_add user_add("John", "Doe") funcs.purge_resources() self.audi = funcs.resource_add("car", "Audi A4") self.passat = funcs.resource_add("car", "VW Passat") self.boxter = funcs.resource_add("car", "Porsche Boxter S") self.cars = funcs.resource_add( "collection", "Company Cars", [self.audi['dn'], self.passat['dn'], self.boxter['dn']]) from tests.functional.synchronize import synchronize_once synchronize_once()
def test_003_givenname_fc_dot_surname(self): self.set('example.org', 'policy_uid', "'%(givenname)s'[0:1].%(surname)s") from tests.functional.user_add import user_add user_add("John", "Doe") from tests.functional.synchronize import synchronize_once synchronize_once() auth = Auth() auth.connect() user = auth.find_recipient('*****@*****.**') user_info = wap_client.user_info(user) self.assertEqual(user_info['uid'], "J.Doe") from tests.functional.purge_users import purge_users purge_users()
def test_009_send_plaintext_forwarded(self): subject = "test_009_send_plaintext_forwarded" body = "This is a plaintext message" from tests.functional.user_add import user_add user_add("Jane", "Doe") from tests.functional.synchronize import synchronize_once synchronize_once() admin_login = conf.get('cyrus-imap', 'admin_login') admin_password = conf.get('cyrus-imap', 'admin_password') import sievelib.factory script = sievelib.factory.FiltersSet("test_wallace_test_009_forward") script.require("copy") script.addfilter("forward", ["true"], [("redirect", ":copy", "*****@*****.**")]) import sievelib.managesieve sieveclient = sievelib.managesieve.Client('localhost', 4190, True) sieveclient.connect(None, None, True) sieveclient._plain_authentication(admin_login, admin_password, '*****@*****.**') sieveclient.authenticated = True script_str = script.__str__() print script_str sieveclient.putscript("test_wallace_test_009_forward", script_str) sieveclient.setactive("test_wallace_test_009_forward") msg = MIMEText(body) msg['From'] = self.message_from msg['To'] = '"Doe, Jane" <*****@*****.**>' msg['Subject'] = subject msg['Date'] = formatdate(localtime=True) self.send_message(msg, _to='*****@*****.**', _from='*****@*****.**') raise Exception
def setup_class(self, *args, **kw): from tests.functional.purge_users import purge_users purge_users() self.user = { 'local': 'nikolaj.rimskij-korsakov', 'domain': 'example.org' } self.send_to = '*****@*****.**' self.send_from = '*****@*****.**' self.message_to = '"Римский-Корсаков, Николай" <%s>' % (self.send_to) self.message_from = '"Римский-Корсаков, Николай" <%s>' % (self.send_from) from tests.functional.user_add import user_add user_add("Николай", "Римский-Корсаков", preferredlanguage='ru_RU') time.sleep(2) from tests.functional.synchronize import synchronize_once synchronize_once()
def setUp(self): from tests.functional.purge_users import purge_users purge_users() self.john = { 'local': 'john.doe', 'domain': 'example.org' } from tests.functional.user_add import user_add user_add("John", "Doe") funcs.purge_resources() self.audi = funcs.resource_add("car", "Audi A4") self.passat = funcs.resource_add("car", "VW Passat") self.boxter = funcs.resource_add("car", "Porsche Boxter S") self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ]) from tests.functional.synchronize import synchronize_once synchronize_once()
def setup_class(self, *args, **kw): # set language to default pykolab.translate.setUserLanguage(conf.get('kolab','default_locale')) self.itip_reply_subject = _('"%(summary)s" has been %(status)s') from tests.functional.purge_users import purge_users purge_users() self.john = { 'displayname': 'John Doe', 'mail': '*****@*****.**', 'dn': 'uid=doe,ou=People,dc=example,dc=org', 'preferredlanguage': 'en_US', 'mailbox': 'user/[email protected]', 'kolabcalendarfolder': 'user/john.doe/[email protected]', 'kolabtasksfolder': 'user/john.doe/[email protected]', 'kolabinvitationpolicy': ['ACT_UPDATE_AND_NOTIFY','ACT_MANUAL'] } self.jane = { 'displayname': 'Jane Manager', 'mail': '*****@*****.**', 'dn': 'uid=manager,ou=People,dc=example,dc=org', 'preferredlanguage': 'en_US', 'mailbox': 'user/[email protected]', 'kolabcalendarfolder': 'user/jane.manager/[email protected]', 'kolabtasksfolder': 'user/jane.manager/[email protected]', 'kolabconfidentialcalendar': 'user/jane.manager/Calendar/[email protected]', 'kolabinvitationpolicy': ['ACT_ACCEPT_IF_NO_CONFLICT','ACT_REJECT_IF_CONFLICT','TASK_ACCEPT','ACT_UPDATE'] } self.jack = { 'displayname': 'Jack Tentative', 'mail': '*****@*****.**', 'dn': 'uid=tentative,ou=People,dc=example,dc=org', 'preferredlanguage': 'en_US', 'mailbox': 'user/[email protected]', 'kolabcalendarfolder': 'user/jack.tentative/[email protected]', 'kolabtasksfolder': 'user/jack.tentative/[email protected]', 'kolabinvitationpolicy': ['ACT_TENTATIVE_IF_NO_CONFLICT','ALL_SAVE_TO_FOLDER','ACT_UPDATE'] } self.mark = { 'displayname': 'Mark German', 'mail': '*****@*****.**', 'dn': 'uid=german,ou=People,dc=example,dc=org', 'preferredlanguage': 'de_DE', 'mailbox': 'user/[email protected]', 'kolabcalendarfolder': 'user/mark.german/[email protected]', 'kolabtasksfolder': 'user/mark.german/[email protected]', 'kolabinvitationpolicy': ['ACT_ACCEPT','ACT_UPDATE_AND_NOTIFY'] } self.external = { 'displayname': 'Bob External', 'mail': '*****@*****.**' } from tests.functional.user_add import user_add user_add("John", "Doe", kolabinvitationpolicy=self.john['kolabinvitationpolicy'], preferredlanguage=self.john['preferredlanguage']) user_add("Jane", "Manager", kolabinvitationpolicy=self.jane['kolabinvitationpolicy'], preferredlanguage=self.jane['preferredlanguage']) user_add("Jack", "Tentative", kolabinvitationpolicy=self.jack['kolabinvitationpolicy'], preferredlanguage=self.jack['preferredlanguage']) user_add("Mark", "German", kolabinvitationpolicy=self.mark['kolabinvitationpolicy'], preferredlanguage=self.mark['preferredlanguage']) time.sleep(1) from tests.functional.synchronize import synchronize_once synchronize_once() # create confidential calendar folder for jane imap = IMAP() imap.connect(domain='example.org') # sets self.domain imap.user_mailbox_create_additional_folders(self.jane['mail'], { 'Calendar/Confidential': { 'annotations': { '/shared/vendor/kolab/folder-type': "event", '/private/vendor/kolab/folder-type': "event.confidential" } } }) imap.disconnect()