本文整理汇总了Python中nxdrive.client.RemoteDocumentClient.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteDocumentClient.fetch方法的具体用法?Python RemoteDocumentClient.fetch怎么用?Python RemoteDocumentClient.fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxdrive.client.RemoteDocumentClient
的用法示例。
在下文中一共展示了RemoteDocumentClient.fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import fetch [as 别名]
def setUp(self):
# Check the Nuxeo server test environment
self.nuxeo_url = os.environ.get('NXDRIVE_TEST_NUXEO_URL')
self.admin_user = os.environ.get('NXDRIVE_TEST_USER')
self.password = os.environ.get('NXDRIVE_TEST_PASSWORD')
if None in (self.nuxeo_url, self.admin_user, self.password):
raise unittest.SkipTest(
"No integration server configuration found in environment.")
# Long timeout for the root client that is responsible for the test
# environment set: this client is doing the first query on the Nuxeo
# server and might need to wait for a long time without failing for
# Nuxeo to finish initialize the repo on the first request after
# startup
root_remote_client = RemoteDocumentClient(
self.nuxeo_url, self.admin_user,
u'nxdrive-test-administrator-device',
password=self.password, base_folder=u'/', timeout=60)
# Call the Nuxeo operation to setup the integration test environment
credentials = root_remote_client.execute(
"NuxeoDrive.SetupIntegrationTests",
userNames="user_1, user_2")
credentials = [c.strip().split(u":") for c in credentials.split(u",")]
self.user_1, self.password_1 = credentials[0]
self.user_2, self.password_2 = credentials[1]
ws_info = root_remote_client.fetch(self.TEST_WORKSPACE_PATH)
self.workspace = ws_info[u'uid']
self.workspace_title = ws_info[u'title']
# Document client to be used to create remote test documents
# and folders
self.upload_tmp_dir = tempfile.mkdtemp(u'-nxdrive-uploads')
remote_document_client_1 = RemoteDocumentClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
password=self.password_1, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
remote_document_client_2 = RemoteDocumentClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
password=self.password_2, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
# File system client to be used to create remote test documents
# and folders
remote_file_system_client_1 = RemoteFileSystemClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
password=self.password_1, upload_tmp_dir=self.upload_tmp_dir)
remote_file_system_client_2 = RemoteFileSystemClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
password=self.password_2, upload_tmp_dir=self.upload_tmp_dir)
# Check the local filesystem test environment
self.local_test_folder_1 = tempfile.mkdtemp(u'-nxdrive-tests-user-1')
self.local_test_folder_2 = tempfile.mkdtemp(u'-nxdrive-tests-user-2')
self.local_nxdrive_folder_1 = os.path.join(
self.local_test_folder_1, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_1)
self.local_nxdrive_folder_2 = os.path.join(
self.local_test_folder_2, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_2)
self.nxdrive_conf_folder_1 = os.path.join(
self.local_test_folder_1, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_1)
self.nxdrive_conf_folder_2 = os.path.join(
self.local_test_folder_2, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_2)
# Set echo to True to enable SQL statements logging
self.controller_1 = Controller(self.nxdrive_conf_folder_1,
echo=False)
self.controller_2 = Controller(self.nxdrive_conf_folder_2,
echo=False)
self.root_remote_client = root_remote_client
self.remote_document_client_1 = remote_document_client_1
self.remote_document_client_2 = remote_document_client_2
self.remote_file_system_client_1 = remote_file_system_client_1
self.remote_file_system_client_2 = remote_file_system_client_2
示例2: UnitTestCase
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import fetch [as 别名]
class UnitTestCase(unittest.TestCase):
def setUpServer(self, server_profile=None):
# Long timeout for the root client that is responsible for the test
# environment set: this client is doing the first query on the Nuxeo
# server and might need to wait for a long time without failing for
# Nuxeo to finish initialize the repo on the first request after
# startup
self.root_remote_client = RemoteDocumentClient(
self.nuxeo_url, self.admin_user,
u'nxdrive-test-administrator-device', self.version,
password=self.password, base_folder=u'/', timeout=60)
# Activate given profile if needed, eg. permission hierarchy
if server_profile is not None:
self.root_remote_client.activate_profile(server_profile)
# Call the Nuxeo operation to setup the integration test environment
credentials = self.root_remote_client.execute(
"NuxeoDrive.SetupIntegrationTests",
userNames="user_1, user_2", permission='ReadWrite')
credentials = [c.strip().split(u":") for c in credentials.split(u",")]
self.user_1, self.password_1 = credentials[0]
self.user_2, self.password_2 = credentials[1]
ws_info = self.root_remote_client.fetch(TEST_WORKSPACE_PATH)
self.workspace = ws_info[u'uid']
self.workspace_title = ws_info[u'title']
self.workspace_1 = self.workspace
self.workspace_2 = self.workspace
self.workspace_title_1 = self.workspace_title
self.workspace_title_2 = self.workspace_title
def tearDownServer(self, server_profile=None):
# Don't need to revoke tokens for the file system remote clients
# since they use the same users as the remote document clients
self.root_remote_client.execute("NuxeoDrive.TearDownIntegrationTests")
# Deactivate given profile if needed, eg. permission hierarchy
if server_profile is not None:
self.root_remote_client.deactivate_profile(server_profile)
def setUpApp(self, server_profile=None):
# Check the Nuxeo server test environment
self.nuxeo_url = os.environ.get('NXDRIVE_TEST_NUXEO_URL')
self.admin_user = os.environ.get('NXDRIVE_TEST_USER')
self.password = os.environ.get('NXDRIVE_TEST_PASSWORD')
self.build_workspace = os.environ.get('WORKSPACE')
self.result = None
self.tearedDown = False
# Take default parameter if none has been set
if self.nuxeo_url is None:
self.nuxeo_url = "http://localhost:8080/nuxeo"
if self.admin_user is None:
self.admin_user = "Administrator"
if self.password is None:
self.password = "Administrator"
self.tmpdir = None
if self.build_workspace is not None:
self.tmpdir = os.path.join(self.build_workspace, "tmp")
if not os.path.isdir(self.tmpdir):
os.makedirs(self.tmpdir)
self.upload_tmp_dir = tempfile.mkdtemp(u'-nxdrive-uploads', dir=self.tmpdir)
if None in (self.nuxeo_url, self.admin_user, self.password):
raise unittest.SkipTest(
"No integration server configuration found in environment.")
# Check the local filesystem test environment
self.local_test_folder_1 = tempfile.mkdtemp(u'-nxdrive-tests-user-1', dir=self.tmpdir)
self.local_test_folder_2 = tempfile.mkdtemp(u'-nxdrive-tests-user-2', dir=self.tmpdir)
self.local_nxdrive_folder_1 = os.path.join(
self.local_test_folder_1, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_1)
self.local_nxdrive_folder_2 = os.path.join(
self.local_test_folder_2, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_2)
self.nxdrive_conf_folder_1 = os.path.join(
self.local_test_folder_1, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_1)
self.nxdrive_conf_folder_2 = os.path.join(
self.local_test_folder_2, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_2)
from mock import Mock
options = Mock()
options.debug = False
options.delay = TEST_DEFAULT_DELAY
options.force_locale = None
options.proxy_server = None
options.log_level_file = None
options.update_site_url = None
options.beta_update_site_url = None
options.autolock_interval = 30
options.nxdrive_home = self.nxdrive_conf_folder_1
self.manager_1 = Manager(options)
self.connected = False
#.........这里部分代码省略.........
示例3: setUp
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import fetch [as 别名]
def setUp(self):
# Check the Nuxeo server test environment
self.nuxeo_url = os.environ.get('NXDRIVE_TEST_NUXEO_URL')
self.admin_user = os.environ.get('NXDRIVE_TEST_USER')
self.password = os.environ.get('NXDRIVE_TEST_PASSWORD')
self.build_workspace = os.environ.get('WORKSPACE')
# Take default parameter if none has been set
if self.nuxeo_url is None:
self.nuxeo_url = "http://localhost:8080/nuxeo"
if self.admin_user is None:
self.admin_user = "Administrator"
if self.password is None:
self.password = "Administrator"
self.tmpdir = None
if self.build_workspace is not None:
self.tmpdir = os.path.join(self.build_workspace, "tmp")
if not os.path.isdir(self.tmpdir):
os.makedirs(self.tmpdir)
if None in (self.nuxeo_url, self.admin_user, self.password):
raise unittest.SkipTest(
"No integration server configuration found in environment.")
# Check the local filesystem test environment
self.local_test_folder_1 = tempfile.mkdtemp(u'-nxdrive-tests-user-1', dir=self.tmpdir)
self.local_test_folder_2 = tempfile.mkdtemp(u'-nxdrive-tests-user-2', dir=self.tmpdir)
self.local_nxdrive_folder_1 = os.path.join(
self.local_test_folder_1, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_1)
self.local_nxdrive_folder_2 = os.path.join(
self.local_test_folder_2, u'Nuxeo Drive')
os.mkdir(self.local_nxdrive_folder_2)
self.nxdrive_conf_folder_1 = os.path.join(
self.local_test_folder_1, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_1)
self.nxdrive_conf_folder_2 = os.path.join(
self.local_test_folder_2, u'nuxeo-drive-conf')
os.mkdir(self.nxdrive_conf_folder_2)
self.version = nxdrive.__version__
# Long timeout for the root client that is responsible for the test
# environment set: this client is doing the first query on the Nuxeo
# server and might need to wait for a long time without failing for
# Nuxeo to finish initialize the repo on the first request after
# startup
root_remote_client = RemoteDocumentClient(
self.nuxeo_url, self.admin_user,
u'nxdrive-test-administrator-device', self.version,
password=self.password, base_folder=u'/', timeout=60)
# Call the Nuxeo operation to setup the integration test environment
credentials = root_remote_client.execute(
"NuxeoDrive.SetupIntegrationTests",
userNames="user_1, user_2", permission='ReadWrite')
credentials = [c.strip().split(u":") for c in credentials.split(u",")]
self.user_1, self.password_1 = credentials[0]
self.user_2, self.password_2 = credentials[1]
ws_info = root_remote_client.fetch(TEST_WORKSPACE_PATH)
self.workspace = ws_info[u'uid']
self.workspace_title = ws_info[u'title']
# Document client to be used to create remote test documents
# and folders
self.upload_tmp_dir = tempfile.mkdtemp(u'-nxdrive-uploads', dir=self.tmpdir)
remote_document_client_1 = RemoteDocumentClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
remote_document_client_2 = RemoteDocumentClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
# File system client to be used to create remote test documents
# and folders
remote_file_system_client_1 = RemoteFileSystemClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1, upload_tmp_dir=self.upload_tmp_dir)
remote_file_system_client_2 = RemoteFileSystemClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2, upload_tmp_dir=self.upload_tmp_dir)
self.root_remote_client = root_remote_client
self.remote_document_client_1 = remote_document_client_1
self.remote_document_client_2 = remote_document_client_2
self.remote_file_system_client_1 = remote_file_system_client_1
self.remote_file_system_client_2 = remote_file_system_client_2
#.........这里部分代码省略.........
示例4: setUpApp
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import fetch [as 别名]
#.........这里部分代码省略.........
# environment set: this client is doing the first query on the Nuxeo
# server and might need to wait for a long time without failing for
# Nuxeo to finish initialize the repo on the first request after
# startup
root_remote_client = RemoteDocumentClient(
self.nuxeo_url, self.admin_user,
u'nxdrive-test-administrator-device', self.version,
password=self.password, base_folder=u'/', timeout=60)
# Activate given profile if needed, eg. permission hierarchy
if server_profile is not None:
root_remote_client.activate_profile(server_profile)
# Call the Nuxeo operation to setup the integration test environment
credentials = root_remote_client.execute(
"NuxeoDrive.SetupIntegrationTests",
userNames="user_1, user_2", permission='ReadWrite')
credentials = [c.strip().split(u":") for c in credentials.split(u",")]
self.user_1, self.password_1 = credentials[0]
self.user_2, self.password_2 = credentials[1]
self.engine_1 = self.manager_1.bind_server(self.local_nxdrive_folder_1, self.nuxeo_url, self.user_1,
self.password_1, start_engine=False)
self.engine_2 = self.manager_2.bind_server(self.local_nxdrive_folder_2, self.nuxeo_url, self.user_2,
self.password_2, start_engine=False)
self.engine_1.syncCompleted.connect(self.app.sync_completed)
self.engine_1.get_remote_watcher().remoteScanFinished.connect(self.app.remote_scan_completed)
self.engine_1.get_remote_watcher().changesFound.connect(self.app.remote_changes_found)
self.engine_1.get_remote_watcher().noChangesFound.connect(self.app.no_remote_changes_found)
self.engine_2.syncCompleted.connect(self.app.sync_completed)
self.engine_2.get_remote_watcher().remoteScanFinished.connect(self.app.remote_scan_completed)
self.engine_2.get_remote_watcher().changesFound.connect(self.app.remote_changes_found)
self.engine_2.get_remote_watcher().noChangesFound.connect(self.app.no_remote_changes_found)
self.queue_manager_1 = self.engine_1.get_queue_manager()
self.queue_manager_2 = self.engine_2.get_queue_manager()
ws_info = root_remote_client.fetch(TEST_WORKSPACE_PATH)
self.workspace = ws_info[u'uid']
self.workspace_title = ws_info[u'title']
self.sync_root_folder_1 = os.path.join(self.local_nxdrive_folder_1, self.workspace_title)
self.sync_root_folder_2 = os.path.join(self.local_nxdrive_folder_2, self.workspace_title)
self.local_root_client_1 = self.engine_1.get_local_client()
self.local_root_client_2 = self.engine_2.get_local_client()
self.local_client_1 = LocalClient(os.path.join(self.local_nxdrive_folder_1, self.workspace_title))
self.local_client_2 = LocalClient(os.path.join(self.local_nxdrive_folder_2, self.workspace_title))
# Document client to be used to create remote test documents
# and folders
self.upload_tmp_dir = tempfile.mkdtemp(u'-nxdrive-uploads', dir=self.tmpdir)
remote_document_client_1 = RemoteDocumentClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
remote_document_client_2 = RemoteDocumentClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2, base_folder=self.workspace,
upload_tmp_dir=self.upload_tmp_dir)
# File system client to be used to create remote test documents
# and folders
remote_file_system_client_1 = RemoteFileSystemClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1, upload_tmp_dir=self.upload_tmp_dir)
remote_file_system_client_2 = RemoteFileSystemClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2, upload_tmp_dir=self.upload_tmp_dir)
self.remote_restapi_client_1 = RestAPIClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1
)
self.remote_restapi_client_2 = RestAPIClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2
)
# Register root
remote_document_client_1.register_as_root(self.workspace)
remote_document_client_2.register_as_root(self.workspace)
self.root_remote_client = root_remote_client
self.remote_document_client_1 = remote_document_client_1
self.remote_document_client_2 = remote_document_client_2
self.remote_file_system_client_1 = remote_file_system_client_1
self.remote_file_system_client_2 = remote_file_system_client_2
self._wait_sync = {self.engine_1.get_uid(): True, self.engine_2.get_uid(): True}
self._wait_remote_scan = {self.engine_1.get_uid(): True, self.engine_2.get_uid(): True}
self._remote_changes_count = {self.engine_1.get_uid(): 0, self.engine_2.get_uid(): 0}
self._no_remote_changes = {self.engine_1.get_uid(): False, self.engine_2.get_uid(): False}