当前位置: 首页>>代码示例>>Python>>正文


Python RemoteDocumentClient.exists方法代码示例

本文整理汇总了Python中nxdrive.client.RemoteDocumentClient.exists方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteDocumentClient.exists方法的具体用法?Python RemoteDocumentClient.exists怎么用?Python RemoteDocumentClient.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nxdrive.client.RemoteDocumentClient的用法示例。


在下文中一共展示了RemoteDocumentClient.exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_remote_move_to_non_sync_root

# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import exists [as 别名]
    def test_remote_move_to_non_sync_root(self):
        sb, ctl = self.sb_1, self.controller_1
        session = ctl.get_session()

        # Grant ReadWrite permission on Workspaces for test user
        workspaces_path = u'/default-domain/workspaces'
        op_input = "doc:" + workspaces_path
        self.root_remote_client.execute("Document.SetACE",
            op_input=op_input,
            user="nuxeoDriveTestUser_user_1",
            permission="ReadWrite",
            grant="true")

        workspaces_info = self.root_remote_client.fetch(workspaces_path)
        workspaces = workspaces_info[u'uid']

        # Get remote client with Workspaces as base folder and local client
        remote_client = RemoteDocumentClient(
            self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
            self.version,
            password=self.password_1, base_folder=workspaces,
            upload_tmp_dir=self.upload_tmp_dir)
        local_client = self.local_client_1

        # Create a non synchronized folder
        remote_client.make_folder(u'/', u'Non synchronized folder')

        # Move Original Folder 1 to Non synchronized folder
        remote_client.move(u'/nuxeo-drive-test-workspace/Original Folder 1',
                           u'/Non synchronized folder')
        self.assertFalse(remote_client.exists(
                            u'/nuxeo-drive-test-workspace/Original Folder 1'))
        self.assertTrue(remote_client.exists(
                            u'/Non synchronized folder/Original Folder 1'))

        # Synchronize: the folder move is detected as a deletion
        self.wait_audit_change_finder_if_needed()
        self.wait()
        self.assertEquals(ctl.synchronizer.update_synchronize_server(sb), 1)

        # Check local folder
        self.assertFalse(local_client.exists(u'/Original Folder 1'))
        # Check folder state
        folder_1_state = session.query(LastKnownState).filter_by(
            remote_name=u'Original Folder 1').all()
        self.assertEquals(len(folder_1_state), 0)

        # The more things change, the more they remain the same.
        self.wait_audit_change_finder_if_needed()
        self.wait()
        self.assertEquals(ctl.synchronizer.update_synchronize_server(sb), 0)
开发者ID:jowensla,项目名称:nuxeo-drive,代码行数:53,代码来源:test_integration_remote_move_and_rename.py

示例2: test_remote_move_to_non_sync_root

# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import exists [as 别名]
    def test_remote_move_to_non_sync_root(self):
        # Grant ReadWrite permission on Workspaces for test user
        workspaces_path = u'/default-domain/workspaces'
        op_input = "doc:" + workspaces_path
        self.root_remote_client.execute("Document.SetACE",
            op_input=op_input,
            user="nuxeoDriveTestUser_user_1",
            permission="ReadWrite",
            grant="true")

        workspaces_info = self.root_remote_client.fetch(workspaces_path)
        workspaces = workspaces_info[u'uid']

        # Get remote client with Workspaces as base folder and local client
        remote_client = RemoteDocumentClient(
            self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
            self.version,
            password=self.password_1, base_folder=workspaces,
            upload_tmp_dir=self.upload_tmp_dir)
        local_client = self.local_client_1

        # Create a non synchronized folder
        unsync_folder = remote_client.make_folder(u'/', u'Non synchronized folder')

        try:
            # Move Original Folder 1 to Non synchronized folder
            remote_client.move(u'/nuxeo-drive-test-workspace/Original Folder 1',
                               u'/Non synchronized folder')
            self.assertFalse(remote_client.exists(
                                u'/nuxeo-drive-test-workspace/Original Folder 1'))
            self.assertTrue(remote_client.exists(
                                u'/Non synchronized folder/Original Folder 1'))

            # Synchronize: the folder move is detected as a deletion
            self.wait_sync(wait_for_async=True)

            # Check local folder
            self.assertFalse(local_client.exists(u'/Original Folder 1'))
            # Check folder state
            folder_1_state = self._get_state(self.folder_1_id)
            self.assertEquals(folder_1_state, None)
        finally:
            # Clean the non synchronized folder
            remote_client.delete(unsync_folder, use_trash=False)
开发者ID:Bindupriya,项目名称:nuxeo-drive,代码行数:46,代码来源:test_remote_move_and_rename.py


注:本文中的nxdrive.client.RemoteDocumentClient.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。