def test_account_delegated_login(self): admin_zc = ZimbraAdminClient(TEST_CONF['host'], TEST_CONF['admin_port']) admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password']) new_zc = ZimbraMailClient(TEST_CONF['host']) new_zc.delegated_login(TEST_CONF['lambda_user'], admin_zc) self.assertTrue(new_zc._session.is_logged_in()) self.assertTrue(new_zc.is_session_valid())
def test_get_share_info(self): # No shares yes shares = self.zc.get_share_info() self.assertEqual(shares, []) # Create share admin_zc = ZimbraAdminClient(TEST_CONF['host'], TEST_CONF['admin_port']) admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password']) mail_zc2 = ZimbraMailClient( TEST_CONF['host'], TEST_CONF['webmail_port']) mail_zc2.delegated_login(TEST_CONF['lambda_user2'], admin_zc) mail_zc2.modify_folder_grant( folder_ids=['1'], grantee_name=TEST_CONF['lambda_user'], perm='rwixd', gt='usr' ) shares = self.zc.get_share_info() self.assertEqual(shares[0]['ownerEmail'], TEST_CONF['lambda_user2']) # Clean mail_zc2.modify_folder_grant( folder_ids=['1'], zid=admin_zc.get_account( Account(name=TEST_CONF['lambda_user'])).id, perm='none', gt='usr' )
def test_folder_grant_mount_revoke(self): admin_zc = ZimbraAdminClient(TEST_CONF['host'], TEST_CONF['admin_port']) admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password']) grantee_zc = ZimbraMailClient(TEST_CONF['host']) grantee_zc.delegated_login(TEST_CONF['lambda_user2'], admin_zc) grantee_id = admin_zc.get_account( Account(name=TEST_CONF['lambda_user2']) )._a_tags['zimbraId'] right = 'rwidx' self.zc.modify_folder_grant( folder_ids=['1'], perm=right, zid=grantee_id ) f_gt = self.zc.get_folder_grant(path='/') self.assertEqual(f_gt['grant']['perm'], right) self.assertEqual(f_gt['grant']['d'], TEST_CONF['lambda_user2']) mount_name = 'MountedZimsoapTest' grantee_zc.create_mountpoint( name=mount_name, path='/', owner=TEST_CONF['lambda_user'], l='1' ) mount_path = '/' + mount_name link = grantee_zc.get_mountpoint(path=mount_path)['link'] self.assertEqual(link['name'], mount_name) self.assertEqual(link['owner'], TEST_CONF['lambda_user']) # Clean grantee grantee_zc.delete_mountpoints(folder_ids=[link['id']]) # Revoke rights self.zc.modify_folder_grant( folder_ids=['1'], perm='none', zid=grantee_id ) f_gt = self.zc.get_folder_grant(path='/') self.assertEqual(f_gt, {})
def test_login(self): zc = ZimbraMailClient(self.TEST_SERVER) zc.login(self.TEST_LOGIN, self.TEST_PASSWORD) self.assertTrue(zc._session.is_logged_in())