Пример #1
0
 def test_delete_mailing_list(self):
     """Delete a mailing list; return True."""
     list_address = '*****@*****.**'
     list_member = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     list.create(list_address, list_member)
     self.assertTrue(list.delete(list_address))
Пример #2
0
    def test_create_mailing_list(self):
        """Create a mailing list; return results object."""
        list_name = 'testcreatelist'
        list_domain = 'testdomain.loc'
        list_address = list_name + '@' + list_domain
        list_member = 'testcreatemember' + '@' + list_domain
        list = SpokeMailingList(self.org_name)
        result = list.create(list_address, list_member)['data']

        rdn = '%s=%s' % (self.list_key, list_name)
        container = '%s=%s' % (self.container_attr, self.list_container)
        base_dn = '%s,%s=%s,%s' % (container, self.org_attr, self.org_name,
                                   self.base_dn)
        dn = '%s,%s' % (rdn, base_dn)
        dn_info = {
            'objectClass': ['top', 'inetOrgPerson', self.list_class],
            self.list_key: [list_name],
            'sn': [list_name],
            'cn': [list_name],
            self.list_pri_address_attr: [list_address],
            self.list_enable_attr: ['TRUE'],
            self.list_destination_attr: [list_member],
            self.list_address_attr: [list_address]
        }
        expected_result = [(dn, dn_info)]
        self.assertEqual(result, expected_result)
        list.delete(list_address)
Пример #3
0
 def test_delete_mailing_list(self):
     """Delete a mailing list; return True."""
     list_address = '*****@*****.**'
     list_member = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     list.create(list_address, list_member)
     self.assertTrue(list.delete(list_address))
Пример #4
0
 def test_create_mailing_list(self):
     """Create a mailing list; return results object."""
     list_name = 'testcreatelist'
     list_domain = 'testdomain.loc'
     list_address = list_name + '@' + list_domain
     list_member = 'testcreatemember' + '@' + list_domain
     list = SpokeMailingList(self.org_name)
     result = list.create(list_address, list_member)['data']
     
     rdn = '%s=%s' % (self.list_key, list_name)
     container = '%s=%s' % (self.container_attr, self.list_container)
     base_dn = '%s,%s=%s,%s' % (container, self.org_attr,
                                self.org_name, self.base_dn)
     dn = '%s,%s' % (rdn, base_dn)
     dn_info = {'objectClass': ['top', 'inetOrgPerson', self.list_class],
                 self.list_key: [list_name],
                 'sn': [list_name], 'cn': [list_name],
                 self.list_pri_address_attr: [list_address],
                 self.list_enable_attr: ['TRUE'],
                 self.list_destination_attr: [list_member],
                 self.list_address_attr: [list_address]
                }
     expected_result = [(dn, dn_info)]
     self.assertEqual(result, expected_result)
     list.delete(list_address)
Пример #5
0
 def test_disable_mailing_list(self):
     """Disable mailing list; verify mailing list disabled."""
     list_name, list_domain = self.list_address.split('@')
     list = SpokeMailingList(self.org_name)
     rdn = '%s=%s' % (self.list_key, list_name)
     container = '%s=%s' % (self.container_attr, self.list_container)
     base_dn = '%s,%s=%s,%s' % (container, self.org_attr,
                                self.org_name, self.base_dn)
     dn = '%s,%s' % (rdn, base_dn)
     dn_info = {self.list_enable_attr: ['FALSE']}
     expected_result = [(dn, dn_info)]
     result = list.modify(self.list_address, enable=False)['data']
     self.assertEqual(result, expected_result)
Пример #6
0
 def test_disable_mailing_list(self):
     """Disable mailing list; verify mailing list disabled."""
     list_name, list_domain = self.list_address.split('@')
     list = SpokeMailingList(self.org_name)
     rdn = '%s=%s' % (self.list_key, list_name)
     container = '%s=%s' % (self.container_attr, self.list_container)
     base_dn = '%s,%s=%s,%s' % (container, self.org_attr, self.org_name,
                                self.base_dn)
     dn = '%s,%s' % (rdn, base_dn)
     dn_info = {self.list_enable_attr: ['FALSE']}
     expected_result = [(dn, dn_info)]
     result = list.modify(self.list_address, enable=False)['data']
     self.assertEqual(result, expected_result)
Пример #7
0
 def test_create_invalid_mailing_list(self):
     """Create a mailing list with invalid name; raise InputError."""
     list_address = 'testnodomain@'
     list_member = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     self.assertRaises(error.InputError, list.create, list_address,
                       list_member)
Пример #8
0
 def test_get_all_mailing_lists(self):
     """Retrieve all mailing lists; return results object."""
     expected_result = []
     list_address2 = '*****@*****.**'
     list_member2 = '*****@*****.**'
     for u in ((self.list_address, self.list_member), (list_address2,
                                                       list_member2)):
         list_address = u[0]
         list_member = u[1]
         list_name, list_domain = list_address.split('@')
         rdn = '%s=%s' % (self.list_key, list_name)
         container = '%s=%s' % (self.container_attr, self.list_container)
         base_dn = '%s,%s=%s,%s' % (container, self.org_attr, self.org_name,
                                    self.base_dn)
         dn = '%s,%s' % (rdn, base_dn)
         dn_info = {
             'objectClass': ['top', 'inetOrgPerson', self.list_class],
             self.list_key: [list_name],
             'sn': [list_name],
             'cn': [list_name],
             self.list_pri_address_attr: [list_address],
             self.list_enable_attr: ['TRUE'],
             self.list_destination_attr: [list_member],
             self.list_address_attr: [list_address]
         }
         append_this = (dn, dn_info)
         expected_result.append(append_this)
     list = SpokeMailingList(self.org_name)
     list.create(list_address2, list_member2)
     result = list.get()['data']
     self.assertEqual(result, expected_result)
     list.delete(list_address2)
Пример #9
0
 def test_get_mailing_list(self):
     """Retrieve a mailing list; return results object."""
     list = SpokeMailingList(self.org_name)
     result = list.get(self.list_address)['data']
     list_name, list_domain = self.list_address.split('@')
     rdn = '%s=%s' % (self.list_key, list_name)
     container = '%s=%s' % (self.container_attr, self.list_container)
     base_dn = '%s,%s=%s,%s' % (container, self.org_attr,
                                self.org_name, self.base_dn)
     dn = '%s,%s' % (rdn, base_dn)
     dn_info = {'objectClass': ['top', 'inetOrgPerson', self.list_class],
                 self.list_key: [list_name],
                 'sn': [list_name], 'cn': [list_name],
                 self.list_pri_address_attr: [self.list_address],
                 self.list_enable_attr: ['TRUE'],
                 self.list_destination_attr: [self.list_member],
                 self.list_address_attr: [self.list_address]
                }
     expected_result = [(dn, dn_info)]
     self.assertEqual(result, expected_result)
Пример #10
0
 def test_get_all_mailing_lists(self):
     """Retrieve all mailing lists; return results object."""      
     expected_result = []
     list_address2 = '*****@*****.**'
     list_member2 = '*****@*****.**' 
     for u in ((self.list_address, self.list_member), 
               (list_address2, list_member2)):
         list_address = u[0]
         list_member = u[1]
         list_name, list_domain = list_address.split('@')
         rdn = '%s=%s' % (self.list_key, list_name)
         container = '%s=%s' % (self.container_attr, self.list_container)
         base_dn = '%s,%s=%s,%s' % (container, self.org_attr,
                                self.org_name, self.base_dn)
         dn = '%s,%s' % (rdn, base_dn)
         dn_info = {'objectClass': ['top', 'inetOrgPerson', 
                                    self.list_class],
                 self.list_key: [list_name],
                 'sn': [list_name], 'cn': [list_name],
                 self.list_pri_address_attr: [list_address],
                 self.list_enable_attr: ['TRUE'],
                 self.list_destination_attr: [list_member],
                 self.list_address_attr: [list_address]
                }
         append_this = (dn, dn_info)
         expected_result.append(append_this)
     list = SpokeMailingList(self.org_name)
     list.create(list_address2, list_member2)
     result = list.get()['data']
     self.assertEqual(result, expected_result)
     list.delete(list_address2)
Пример #11
0
 def test_get_mailing_list(self):
     """Retrieve a mailing list; return results object."""
     list = SpokeMailingList(self.org_name)
     result = list.get(self.list_address)['data']
     list_name, list_domain = self.list_address.split('@')
     rdn = '%s=%s' % (self.list_key, list_name)
     container = '%s=%s' % (self.container_attr, self.list_container)
     base_dn = '%s,%s=%s,%s' % (container, self.org_attr, self.org_name,
                                self.base_dn)
     dn = '%s,%s' % (rdn, base_dn)
     dn_info = {
         'objectClass': ['top', 'inetOrgPerson', self.list_class],
         self.list_key: [list_name],
         'sn': [list_name],
         'cn': [list_name],
         self.list_pri_address_attr: [self.list_address],
         self.list_enable_attr: ['TRUE'],
         self.list_destination_attr: [self.list_member],
         self.list_address_attr: [self.list_address]
     }
     expected_result = [(dn, dn_info)]
     self.assertEqual(result, expected_result)
Пример #12
0
 def test_create_mailing_list_twice(self):
     """Create a mailling list twice; raise AlreadyExists."""
     list = SpokeMailingList(self.org_name)
     self.assertRaises(error.AlreadyExists, list.create, self.list_address,
                       self.list_member)
Пример #13
0
 def tearDown(self):
     list = SpokeMailingList(self.org_name)
     list.delete(self.list_address)
     org = SpokeOrg()
     org.delete(self.org_name)
Пример #14
0
 def test_get_missing_mailing_list(self):
     """Retrieve missing mailing list; return empty list."""
     list_address = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     self.assertFalse(list.get(list_address)['data'])
Пример #15
0
 def setUp(self):
     org = SpokeOrg()
     org.create(self.org_name)
     list = SpokeMailingList(self.org_name)
     list.create(self.list_address, self.list_member)
Пример #16
0
 def test_delete_missing_mailing_list(self):
     """Delete a non existent mailing list; raise NotFound."""
     list_address = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     self.assertRaises(error.NotFound, list.delete, list_address)
Пример #17
0
 def setUp(self):
     org = SpokeOrg()
     org.create(self.org_name)
     list = SpokeMailingList(self.org_name)
     list.create(self.list_address, self.list_member)
Пример #18
0
 def test_get_missing_mailing_list(self):
     """Retrieve missing mailing list; return empty list."""
     list_address = '*****@*****.**'
     list = SpokeMailingList(self.org_name)
     self.assertFalse(list.get(list_address)['data'])
Пример #19
0
 def tearDown(self):
     list = SpokeMailingList(self.org_name)
     list.delete(self.list_address)
     org = SpokeOrg()
     org.delete(self.org_name)