本文整理汇总了Python中nxdrive.client.RemoteDocumentClient.activate_profile方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteDocumentClient.activate_profile方法的具体用法?Python RemoteDocumentClient.activate_profile怎么用?Python RemoteDocumentClient.activate_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxdrive.client.RemoteDocumentClient
的用法示例。
在下文中一共展示了RemoteDocumentClient.activate_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UnitTestCase
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import activate_profile [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
#.........这里部分代码省略.........
示例2: setUpApp
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import activate_profile [as 别名]
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)
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)
import nxdrive
nxdrive_path = os.path.dirname(nxdrive.__file__)
i18n_path = os.path.join(nxdrive_path, 'tests', 'resources', "i18n.js")
Translator(self.manager_1, i18n_path)
options.nxdrive_home = self.nxdrive_conf_folder_2
Manager._singleton = None
self.manager_2 = Manager(options)
self.version = __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)
# 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()
#.........这里部分代码省略.........