Beispiel #1
0
 def test_create_email_account(self):
     """Create email account; return email account object."""
     first = 'create_email'
     last = 'account_test'
     user_id = first + last
     email_addr = first + last + '@' + self.email_dom
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     
     org = '%s=%s' % (self.org_attr, self.org_name)
     people = '%s=%s' % (self.container_attr, self.user_container)
     uid = '%s=%s' % (self.user_key, user_id)
     dn = '%s,%s,%s,%s' % (uid, people, org, self.base_dn)
     dn_info = {'objectClass': ['top', 'inetOrgPerson', self.user_class,
                                 self.imap_class, self.smtp_class],
                self.imap_enable: ['TRUE'],
                self.imap_mailbox: [user_id],
                self.imap_domain: [self.email_dom],
                self.imap_partition: [self.imap_partition_def],
                self.smtp_destination: [email_addr],
                self.smtp_enable: ['TRUE'],
                self.smtp_pri_address: [email_addr]
                }
     expected_result = [(dn, dn_info)]        
     acc = SpokeEmailAccount(self.org_name, user_id)
     result = acc.create(email_addr)['data']
     self.assertEqual(result, expected_result)
     user.delete(first, last)
Beispiel #2
0
    def test_create_email_account(self):
        """Create email account; return email account object."""
        first = 'create_email'
        last = 'account_test'
        user_id = first + last
        email_addr = first + last + '@' + self.email_dom
        user = SpokeUser(self.org_name)
        user.create(email_addr, first, last)

        org = '%s=%s' % (self.org_attr, self.org_name)
        people = '%s=%s' % (self.container_attr, self.user_container)
        uid = '%s=%s' % (self.user_key, user_id)
        dn = '%s,%s,%s,%s' % (uid, people, org, self.base_dn)
        dn_info = {
            'objectClass': [
                'top', 'inetOrgPerson', self.user_class, self.imap_class,
                self.smtp_class
            ],
            self.imap_enable: ['TRUE'],
            self.imap_mailbox: [user_id],
            self.imap_domain: [self.email_dom],
            self.imap_partition: [self.imap_partition_def],
            self.smtp_destination: [email_addr],
            self.smtp_enable: ['TRUE'],
            self.smtp_pri_address: [email_addr]
        }
        expected_result = [(dn, dn_info)]
        acc = SpokeEmailAccount(self.org_name, user_id)
        result = acc.create(email_addr)['data']
        self.assertEqual(result, expected_result)
        user.delete(first, last)
Beispiel #3
0
 def test_delete_user(self):
     """Delete user; return True."""
     user = SpokeUser(self.org_name)
     first = 'test_delete_user'
     email_addr = first + '@' + self.email_dom
     user.create(email_addr, first)
     self.assertTrue(user.delete(first))
Beispiel #4
0
 def setUp(self):
     """Create test organisation and user."""
     org = SpokeOrg()
     org.create(self.org_name, self.org_children)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     pwd = SpokePwd(self.org_name, self.user_id)
     pwd.create(self.user_def_pwd)
Beispiel #5
0
 def setUp(self):
     """Create test organisation and user."""
     org = SpokeOrg()
     org.create(self.org_name)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     svn = SpokeSVN(self.org_name, self.user_id)
     svn.create(self.svn_repo_name)
Beispiel #6
0
 def setUp(self):
     """Create test organisation and user."""
     org = SpokeOrg()
     org.create(self.org_name, self.org_children)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     pwd = SpokePwd(self.org_name, self.user_id)
     pwd.create(self.user_def_pwd)
Beispiel #7
0
 def setUp(self):
     """Create test organisation and user."""
     org = SpokeOrg()
     org.create(self.org_name)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     svn = SpokeSVN(self.org_name, self.user_id)
     svn.create(self.svn_repo_name)
Beispiel #8
0
 def setUp(self):
     """Create test organisation, user and email domain."""
     org = SpokeOrg()
     org.create(self.org_name)
     dom = SpokeEmailDomain(self.org_name)
     dom.create(self.email_dom)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     acc = SpokeEmailAccount(self.org_name, self.user_id)
     acc.create(self.email_addr)
Beispiel #9
0
 def setUp(self):
     """Create test organisation, user and email domain."""
     org = SpokeOrg()
     org.create(self.org_name)
     dom = SpokeEmailDomain(self.org_name)
     dom.create(self.email_dom)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first, self.last)
     acc = SpokeEmailAccount(self.org_name, self.user_id)
     acc.create(self.email_addr)
Beispiel #10
0
 def test_delete_missing_email_account(self):
     """Delete a missing email account; raise NotFound."""
     email_addr = 'deletemissing@' + self.email_dom
     first = 'test'
     last = 'missing'
     user_id = first + last
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     acc = SpokeEmailAccount(self.org_name, user_id)
     self.assertRaises(error.NotFound, acc.delete, email_addr)
     user.delete(first, last)
Beispiel #11
0
 def test_delete_missing_email_account(self):
     """Delete a missing email account; raise NotFound."""
     email_addr = 'deletemissing@' + self.email_dom
     first = 'test'
     last = 'missing'
     user_id = first + last
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     acc = SpokeEmailAccount(self.org_name, user_id)
     self.assertRaises(error.NotFound, acc.delete, email_addr)
     user.delete(first, last)
Beispiel #12
0
 def test_get_missing_password(self):
     """Verify a missing password; raise AuthError."""
     first = 'test'
     last = 'getmissingpassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'        
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)       
     pwd = SpokePwd(self.org_name, user_id)
     self.assertRaises(error.AuthError, pwd.get, password)
     user.delete(first, last)
Beispiel #13
0
 def test_get_missing_password(self):
     """Verify a missing password; raise AuthError."""
     first = 'test'
     last = 'getmissingpassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     pwd = SpokePwd(self.org_name, user_id)
     self.assertRaises(error.AuthError, pwd.get, password)
     user.delete(first, last)
Beispiel #14
0
 def test_delete_password(self):
     """Delete user password; return True."""
     first = 'test'
     last = 'deletepassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'       
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     pwd = SpokePwd(self.org_name, user_id)
     pwd.create(password)
     self.assertTrue(pwd.delete, password)
     user.delete(first, last)
Beispiel #15
0
 def test_delete_email_account(self):
     """Delete an email account; return empty results object."""
     first = 'delete_email'
     last = 'account_test'
     user_id = first + last
     email_addr = first + last + '@' + self.email_dom
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     acc = SpokeEmailAccount(self.org_name, user_id)
     acc.create(email_addr)
     newacc = SpokeEmailAccount(self.org_name, user_id)
     self.assertTrue(newacc.delete(email_addr))
     user.delete(first, last)
Beispiel #16
0
 def test_delete_email_account(self):
     """Delete an email account; return empty results object."""
     first = 'delete_email'
     last = 'account_test'
     user_id = first + last
     email_addr = first + last + '@' + self.email_dom
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     acc = SpokeEmailAccount(self.org_name, user_id)
     acc.create(email_addr)
     newacc = SpokeEmailAccount(self.org_name, user_id)
     self.assertTrue(newacc.delete(email_addr))
     user.delete(first, last)
Beispiel #17
0
 def test_delete_password(self):
     """Delete user password; return True."""
     first = 'test'
     last = 'deletepassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     pwd = SpokePwd(self.org_name, user_id)
     pwd.create(password)
     self.assertTrue(pwd.delete, password)
     user.delete(first, last)
Beispiel #18
0
 def test_create_password(self):
     """Create a user password; return success result."""
     first = 'test'
     last = 'createpassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)
     expected_result = ['success']
     pwd = SpokePwd(self.org_name, user_id)
     result = pwd.create(password)['data']
     self.assertEquals(result, expected_result)
     user.delete(first, last)
Beispiel #19
0
 def test_create_password(self):
     """Create a user password; return success result."""
     first = 'test'
     last = 'createpassword'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     password = '******'       
     user = SpokeUser(self.org_name)
     user.create(email_addr, first, last)  
     expected_result = ['success']
     pwd = SpokePwd(self.org_name, user_id)
     result = pwd.create(password)['data']
     self.assertEquals(result, expected_result)
     user.delete(first, last)
Beispiel #20
0
 def test_create_user_first_last(self):
     """Create a user with a first and surname; return a user object."""
     first = 'testCreateUserFirst'
     last = 'Last'
     user_id = first + last
     email_addr = user_id + '@' + self.email_dom
     email_addr = email_addr.lower()
     rdn = '%s=%s' % (self.user_key, user_id)
     container = '%s=%s' % (self.container_attr, self.user_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.user_name: [user_id],
         self.user_key: [user_id],
         'objectClass': ['top', 'inetOrgPerson', self.user_class],
         self.user_login: [email_addr],
         self.user_enable: ['TRUE'],
         'sn': [last],
         'cn': [first]
     }
     expected_result = [(dn, dn_info)]
     user = SpokeUser(self.org_name)
     result = user.create(email_addr, first, last)['data']
     self.assertEqual(result, expected_result)
     user.delete(first, last)
Beispiel #21
0
 def test_get_all_users(self):
     """Retrieve all user accounts; return a list of user objects."""
     user_id2 = 'timmy2'
     email_addr2 = user_id2 + '@' + self.email_dom
     expected_result = []
     for u in (self.first, user_id2):
         rdn = '%s=%s' % (self.user_key, u)
         dn = '%s,%s' % (rdn, self.user_container_dn)
         dn_info = {self.user_name: [u],
                self.user_key: [u],
                'objectClass': ['top', 'inetOrgPerson', self.user_class],
                self.user_login: [u + '@' + self.email_dom],
                self.user_enable: ['TRUE'],
                'sn': [u], 'cn': [u]
                }
         append_this = (dn, dn_info)
         expected_result.append(append_this)
     user = SpokeUser(self.org_name)
     user.create(email_addr2, user_id2)
     result = user.get()['data']
     self.assertEqual(result, expected_result)
     user.delete(user_id2)
Beispiel #22
0
 def test_create_user_first(self):
     """Create a user without a surname; return a user object."""
     first = 'testCreateDeleteUserFirst'
     user_id = first
     email_addr = user_id + '@' + self.email_dom
     email_addr = email_addr.lower()
     rdn = '%s=%s' % (self.user_key, user_id)
     container = '%s=%s' % (self.container_attr, self.user_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.user_name: [user_id],
                self.user_key: [user_id],
                'objectClass': ['top', 'inetOrgPerson', self.user_class],
                self.user_login: [email_addr],
                self.user_enable: ['TRUE'],
                'sn': [first], 'cn': [first]
                }
     expected_result = [(dn, dn_info)]
     user = SpokeUser(self.org_name)
     result = user.create(email_addr, first)['data']
     self.assertEqual(result, expected_result)
     user.delete(first)
Beispiel #23
0
 def setUp(self):
     """Create test organisation and user."""
     org = SpokeOrg()
     org.create(self.org_name, self.org_children)
     user = SpokeUser(self.org_name)
     user.create(self.email_addr, self.first)