예제 #1
0
파일: test_user.py 프로젝트: mattmb/spoke
 def test_get_missing_user(self):
     """Retrieve a missing user account; return an empty list."""
     user_id = 'missinguser'
     expected_result = []
     user = SpokeUser(self.org_name)
     result = user.get(user_id)['data']
     self.assertEqual(result, expected_result)
예제 #2
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)
예제 #3
0
파일: test_email.py 프로젝트: mattmb/spoke
 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)
예제 #4
0
파일: test_user.py 프로젝트: mattmb/spoke
 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))
예제 #5
0
파일: email.py 프로젝트: KrisSaxton/spoke
 def _get_user(self, org_name, user_id):
     """Retrieve a user object."""
     user = SpokeUser(org_name)
     result = user.get(user_id, unique=True)
     if result['data'] == []:
         msg = "Can't find user %s in org %s" % (user_id, org_name)
         raise error.NotFound(msg)
     return result
예제 #6
0
파일: email.py 프로젝트: KrisSaxton/spoke
 def _get_user(self, org_name, user_id):
     """Retrieve a user object."""
     user = SpokeUser(org_name)
     result = user.get(user_id, unique=True)
     if result['data'] == []:
         msg = "Can't find user %s in org %s" % (user_id, org_name)
         raise error.NotFound(msg)          
     return result
예제 #7
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)
예제 #8
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)
예제 #9
0
파일: test_vcs.py 프로젝트: mattmb/spoke
 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)
예제 #10
0
파일: test_vcs.py 프로젝트: mattmb/spoke
 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)
예제 #11
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)
예제 #12
0
파일: test_email.py 프로젝트: mattmb/spoke
 def tearDown(self):
     """Delete test organisation, user and email domain."""
     acc = SpokeEmailAccount(self.org_name, self.user_id)
     acc.delete(self.email_addr)
     user = SpokeUser(self.org_name)
     user.delete(self.first, self.last)
     dom = SpokeEmailDomain(self.org_name)
     dom.delete(self.email_dom)
     org = SpokeOrg()
     org.delete(self.org_name, self.org_children)
예제 #13
0
파일: test_email.py 프로젝트: mattmb/spoke
 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)
예제 #14
0
 def tearDown(self):
     """Delete test organisation, user and email domain."""
     acc = SpokeEmailAccount(self.org_name, self.user_id)
     acc.delete(self.email_addr)
     user = SpokeUser(self.org_name)
     user.delete(self.first, self.last)
     dom = SpokeEmailDomain(self.org_name)
     dom.delete(self.email_dom)
     org = SpokeOrg()
     org.delete(self.org_name, self.org_children)
예제 #15
0
파일: test_email.py 프로젝트: mattmb/spoke
 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)
예제 #16
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)
예제 #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)
예제 #18
0
파일: test_email.py 프로젝트: mattmb/spoke
 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)
예제 #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)
예제 #20
0
파일: test_user.py 프로젝트: mattmb/spoke
 def test_get_user(self):
     """Retrieve a user account; return a user object."""
     rdn = '%s=%s' % (self.user_key, self.user_id)
     dn = '%s,%s' % (rdn, self.user_container_dn)
     dn_info = {self.user_name: [self.user_id],
                self.user_key: [self.user_id],
                'objectClass': ['top', 'inetOrgPerson', self.user_class],
                self.user_login: [self.email_addr],
                self.user_enable: ['TRUE'],
                'sn': [self.first], 'cn': [self.first]
                }
     expected_result = [(dn, dn_info)]
     user = SpokeUser(self.org_name)
     result = user.get(self.first)['data']
     self.assertEqual(result, expected_result)
예제 #21
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)
예제 #22
0
파일: test_user.py 프로젝트: mattmb/spoke
 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)
예제 #23
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)
예제 #24
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)
예제 #25
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)
예제 #26
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)
예제 #27
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)
예제 #28
0
파일: test_user.py 프로젝트: mattmb/spoke
 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)
예제 #29
0
파일: test_vcs.py 프로젝트: mattmb/spoke
 def tearDown(self):
     """Delete test organisation and user"""
     user = SpokeUser(self.org_name)
     user.delete(self.first, self.last)
     org = SpokeOrg()
     org.delete(self.org_name)
예제 #30
0
파일: test_user.py 프로젝트: mattmb/spoke
 def tearDown(self):
     """Delete test organisation and user"""
     user = SpokeUser(self.org_name)
     user.delete(self.first)
     org = SpokeOrg()
     org.delete(self.org_name, self.org_children)
예제 #31
0
파일: test_user.py 프로젝트: mattmb/spoke
 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)
예제 #32
0
파일: test_user.py 프로젝트: mattmb/spoke
 def test_delete_non_existant_user(self):
     """Delete non-existent user; raise NotFound."""
     user = SpokeUser(self.org_name)
     first = 'test_delete_non_existant_user'
     self.assertRaises(error.NotFound, user.delete, first)
예제 #33
0
파일: test_user.py 프로젝트: mattmb/spoke
 def test_create_user_with_invalid_email(self):
     """Create a user with an invalid email address; raise InputError."""
     user = SpokeUser(self.org_name)
     email = 'invalidaddress'
     self.assertRaises(error.InputError, user.create, email, self.first)
예제 #34
0
파일: test_user.py 프로젝트: mattmb/spoke
 def test_create_user_twice(self):
     """Create a user that already exists; raise AlreadyExists."""
     user = SpokeUser(self.org_name)
     self.assertRaises(error.AlreadyExists, user.create, self.email_addr, \
                       self.first)