Skip to content

Commit

Permalink
Merge pull request #54 from oasiswork/mountpoints
Browse files Browse the repository at this point in the history
Simplify mountpoint management
  • Loading branch information
Tuxem authored Sep 8, 2016
2 parents 3dcef3c + cd35c14 commit b284ba1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_zimbra_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def test_folder_grant_mount_revoke(self):
parent_id='1'
)
mount_path = '/' + mount_name
link = grantee_zc.get_folder(path=mount_path)['link']
link = grantee_zc.get_mountpoint(path=mount_path)['link']
self.assertEqual(link['name'], mount_name)
self.assertEqual(link['owner'], TEST_CONF['lambda_user'])

Expand Down
9 changes: 6 additions & 3 deletions zimsoap/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ def create_mountpoint(self, name, path=None, owner=None, parent_id='1'):

return self.request('CreateMountpoint', params)['link']

def delete_folders(self, paths=None, folder_ids=None):
def delete_folders(self, paths=None, folder_ids=None, f_type='folder'):
"""
:param folder_ids: list of ids
:param path: list of folder's paths
Expand All @@ -1427,7 +1427,7 @@ def delete_folders(self, paths=None, folder_ids=None):
f_ids = []
for path in paths:
folder = self.get_folder(path=path)
f_ids.append(folder['folder']['id'])
f_ids.append(folder[f_type]['id'])

comma_ids = self._return_comma_list(f_ids)

Expand All @@ -1443,7 +1443,10 @@ def delete_mountpoints(self, paths=None, folder_ids=None):
:param folder_ids: list of ids
:param path: list of folder's paths
"""
self.delete_folders(paths=paths, folder_ids=folder_ids)
self.delete_folders(paths=paths, folder_ids=folder_ids, f_type='link')

def get_mountpoint(self, mp_id=None, path=None, uuid=None):
return self.get_folder(f_id=mp_id, path=path, uuid=uuid)

def get_folder(self, f_id=None, path=None, uuid=None):
request = {'folder': {}}
Expand Down

0 comments on commit b284ba1

Please sign in to comment.