def test_register_sync_root_parent(self): remote = RemoteDocumentClient(self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local = self.local_root_client_1 # First unregister test Workspace remote.unregister_as_root(self.workspace) # Create a child folder and register it as a synchronization root child = remote.make_folder(self.workspace, 'child') remote.make_file(child, 'aFile.txt', u'My content') remote.register_as_root(child) # Start engine and wait for synchronization self.engine_1.start() self.wait_sync(wait_for_async=True) self.assertFalse(local.exists('/Nuxeo Drive Test Workspace')) self.assertTrue(local.exists('/child')) self.assertTrue(local.exists('/child/aFile.txt')) # Register parent folder remote.register_as_root(self.workspace) # Start engine and wait for synchronization self.wait_sync(wait_for_async=True) self.assertFalse(local.exists('/child')) self.assertTrue(local.exists('/Nuxeo Drive Test Workspace')) self.assertTrue(local.exists('/Nuxeo Drive Test Workspace/child')) self.assertTrue( local.exists('/Nuxeo Drive Test Workspace/child/aFile.txt'))
def test_register_sync_root_parent(self): remote = RemoteDocumentClient(self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local = self.local_root_client_1 # First unregister test Workspace remote.unregister_as_root(self.workspace) # Create a child folder and register it as a synchronization root child = remote.make_folder(self.workspace, 'child') remote.make_file(child, 'aFile.txt', u'My content') remote.register_as_root(child) # Start engine and wait for synchronization self.engine_1.start() self.wait_sync(wait_for_async=True) self.assertFalse(local.exists('/Nuxeo Drive Test Workspace')) self.assertTrue(local.exists('/child')) self.assertTrue(local.exists('/child/aFile.txt')) # Register parent folder remote.register_as_root(self.workspace) # Start engine and wait for synchronization self.wait_sync(wait_for_async=True) self.assertFalse(local.exists('/child')) self.assertTrue(local.exists('/Nuxeo Drive Test Workspace')) self.assertTrue(local.exists('/Nuxeo Drive Test Workspace/child')) self.assertTrue(local.exists('/Nuxeo Drive Test Workspace/child/aFile.txt'))
def test_sync_delete_root(self): user_workspace_uid = None try: # Get remote and local clients admin_remote_client = self.root_remote_client user_remote_client = RemoteDocumentClient( self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local_client = LocalClient(self.local_nxdrive_folder_1) # Make sure user workspace is created and fetch its uid user_workspace_uid = user_remote_client.make_file_in_user_workspace( 'File in user workspace', filename='USFile.txt')['parentRef'] # Create test folder in user workspace as test user test_folder_uid = user_remote_client.make_folder( user_workspace_uid, 'test_folder') # Create a document in the test folder user_remote_client.make_file(test_folder_uid, 'test_file.txt', "Some content.") # Register test folder as a sync root user_remote_client.register_as_root(test_folder_uid) # Start engine self.engine_1.start() # Wait for synchronization self.wait_sync(wait_for_async=True) # Check locally synchronized content self.assertTrue(local_client.exists('/My Docs/test_folder')) self.assertTrue( local_client.exists('/My Docs/test_folder/test_file.txt')) # Delete test folder user_remote_client.delete(test_folder_uid) # Wait for synchronization self.wait_sync(wait_for_async=True) # Check locally synchronized content self.assertFalse(local_client.exists('/My Docs/test_folder')) self.assertEquals(len(local_client.get_children_info('/My Docs')), 0) finally: # Cleanup user workspace if user_workspace_uid is not None and admin_remote_client.exists( user_workspace_uid): admin_remote_client.delete(user_workspace_uid, use_trash=False)
def test_sync_delete_root(self): user_workspaces_path = '/default-domain/UserWorkspaces/' user_workspace_title = 'nuxeoDriveTestUser-user-1' user_workspace_path = user_workspaces_path + user_workspace_title try: # Get remote and local clients admin_remote_client = self.root_remote_client user_remote_client = RemoteDocumentClient( self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local_client = LocalClient(self.local_nxdrive_folder_1) # Make sure user workspace is created user_remote_client.make_file_in_user_workspace('File in user workspace', filename='USFile.txt') # Create test folder in user workspace as test user user_remote_client.make_folder(user_workspace_path, 'test_folder') test_folder_path = user_workspace_path + '/test_folder' # Create a document in the test folder user_remote_client.make_file(test_folder_path, 'test_file.txt', "Some content.") # Register test folder as a sync root user_remote_client.register_as_root(test_folder_path) # Start engine self.engine_1.start() # Wait for synchronization self.wait_sync(wait_for_async=True) # Check locally synchronized content self.assertTrue(local_client.exists('/My Docs/test_folder')) self.assertTrue(local_client.exists('/My Docs/test_folder/test_file.txt')) # Delete test folder user_remote_client.delete(test_folder_path) # Wait for synchronization self.wait_sync(wait_for_async=True) # Check locally synchronized content self.assertFalse(local_client.exists('/My Docs/test_folder')) self.assertEquals(len(local_client.get_children_info('/My Docs')), 0) finally: # Cleanup user workspace if admin_remote_client.exists(user_workspace_path): admin_remote_client.delete(user_workspace_path, use_trash=False)
def test_sync_delete_root(self): user_workspaces_path = '/default-domain/UserWorkspaces/' user_workspace_title = 'nuxeoDriveTestUser-user-1' user_workspace_path = user_workspaces_path + user_workspace_title try: # Get remote and local clients admin_remote_client = self.root_remote_client user_remote_client = RemoteDocumentClient( self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local_client = LocalClient(self.local_nxdrive_folder_1) # Activate permission hierarchy profile as Administrator admin_remote_client.activate_profile('permission') # Make sure user workspace is created user_remote_client.make_file_in_user_workspace( 'File in user workspace', filename='USFile.txt') # Bind server ctl = self.controller_1 ctl.bind_server(self.local_nxdrive_folder_1, self.nuxeo_url, self.user_1, self.password_1) syn = ctl.synchronizer # Create test folder in user workspace as test user user_remote_client.make_folder(user_workspace_path, 'test_folder') test_folder_path = user_workspace_path + '/test_folder' # Create a document in the test folder user_remote_client.make_file(test_folder_path, 'test_file.txt', "Some content.") # Register test folder as a sync root user_remote_client.register_as_root(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertTrue(local_client.exists('/My Docs/test_folder')) self.assertTrue( local_client.exists('/My Docs/test_folder/test_file.txt')) # Delete test folder user_remote_client.delete(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertFalse(local_client.exists('/My Docs/test_folder')) self.assertEquals(len(local_client.get_children_info('/My Docs')), 0) finally: # Cleanup user workspace if admin_remote_client.exists(user_workspace_path): admin_remote_client.delete(user_workspace_path, use_trash=False) # Deactivate permission hierarchy profile admin_remote_client.deactivate_profile('permission')
def test_sync_delete_root(self): user_workspaces_path = '/default-domain/UserWorkspaces/' user_workspace_title = 'nuxeoDriveTestUser-user-1' user_workspace_path = user_workspaces_path + user_workspace_title try: # Get remote and local clients admin_remote_client = self.root_remote_client user_remote_client = RemoteDocumentClient( self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local_client = LocalClient(self.local_nxdrive_folder_1) # Activate permission hierarchy profile as Administrator admin_remote_client.activate_profile('permission') # Make sure user workspace is created user_remote_client.make_file_in_user_workspace( 'File in user workspace', filename='USFile.txt') # Bind server ctl = self.controller_1 ctl.bind_server(self.local_nxdrive_folder_1, self.nuxeo_url, self.user_1, self.password_1) syn = ctl.synchronizer # Create test folder in user workspace as test user user_remote_client.make_folder(user_workspace_path, 'test_folder') test_folder_path = user_workspace_path + '/test_folder' # Create a document in the test folder user_remote_client.make_file(test_folder_path, 'test_file.txt', "Some content.") # Register test folder as a sync root user_remote_client.register_as_root(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertTrue(local_client.exists('/My Docs/test_folder')) self.assertTrue(local_client.exists( '/My Docs/test_folder/test_file.txt')) # Delete test folder user_remote_client.delete(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertFalse(local_client.exists('/My Docs/test_folder')) self.assertEquals(len(local_client.get_children_info('/My Docs')), 0) finally: # Cleanup user workspace if admin_remote_client.exists(user_workspace_path): admin_remote_client.delete(user_workspace_path, use_trash=False) # Deactivate permission hierarchy profile admin_remote_client.deactivate_profile('permission')
def test_sync_delete_root(self): try: user_workspaces_path = '/default-domain/UserWorkspaces/' user_workspace_title = 'nuxeoDriveTestUser_user_1' user_workspace_path = user_workspaces_path + user_workspace_title # Get remote and local clients admin_remote_client = self.root_remote_client user_remote_client = RemoteDocumentClient( self.nuxeo_url, self.user_1, u'nxdrive-test-device-1', self.version, password=self.password_1, upload_tmp_dir=self.upload_tmp_dir) local_client = LocalClient(self.local_nxdrive_folder_1) # Activate permission hierarchy profile as Administrator admin_remote_client.activate_profile('permission') # Bind server ctl = self.controller_1 ctl.bind_server(self.local_nxdrive_folder_1, self.nuxeo_url, self.user_1, self.password_1) syn = ctl.synchronizer # Create user workspace parent as Administrator if it doesn't exist if not admin_remote_client.exists(user_workspaces_path): admin_remote_client.make_folder('/default-domain', 'UserWorkspaces', doc_type='UserWorkspacesRoot') # Create test user workspace as Administrator admin_remote_client.make_folder(user_workspaces_path, user_workspace_title, doc_type='Workspace') # Grant ReadWrite permission to test user on its workspace op_input = "doc:" + user_workspace_path admin_remote_client.execute("Document.SetACE", op_input=op_input, user="******", permission="ReadWrite", grant="true") # Create test folder in user workspace as test user user_remote_client.make_folder(user_workspace_path, 'test_folder') test_folder_path = user_workspace_path + '/test_folder' # Create a document in the test folder user_remote_client.make_file(test_folder_path, 'test_file.txt', "Some content.") # Register test folder as a sync root user_remote_client.register_as_root(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertTrue(local_client.exists('/My Docs/test_folder')) self.assertTrue(local_client.exists( '/My Docs/test_folder/test_file.txt')) # Delete test folder user_remote_client.delete(test_folder_path) # Synchronize self._synchronize(syn) # Check locally synchronized content self.assertFalse(local_client.exists('/My Docs/test_folder')) self.assertEquals(len(local_client.get_children_info('/My Docs')), 0) finally: # Cleanup user workspace if admin_remote_client.exists(user_workspace_path): admin_remote_client.delete(user_workspace_path, use_trash=False) # Deactivate permission hierarchy profile admin_remote_client.deactivate_profile('permission')