def test_system_default(self): original = AbstractOSIntegration.get AbstractOSIntegration.get = staticmethod(getOSIntegration) self.cmd.default_home = tempfile.mkdtemp("config", dir=self.tmpdir) try: self.clean_ini() argv = ["ndrive", "console", "--log-level-console", "DEBUG_TEST"] # Default value options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "SYSTEM_TEST", "The system default is SYSTEM_TEST") # Normal arg options = self.cmd.parse_cli(argv) self.assertEqual(options.log_level_console, "DEBUG_TEST", "Should be debug test") finally: clean_dir(self.cmd.default_home) AbstractOSIntegration.get = staticmethod(original)
def test_default_override(self): self.cmd.default_home = tempfile.mkdtemp("config", dir=self.tmpdir) try: self.clean_ini() argv = ["ndrive", "--log-level-console", "DEBUG_TEST", "console"] # Default value options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "INFO", "The official default is INFO") # Normal arg options = self.cmd.parse_cli(argv) self.assertEqual(options.log_level_console, "DEBUG_TEST", "Should be debug test") # config.ini override self.create_ini() options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "PROD", "The config.ini shoud link to PROD") # config.ini override, but arg specified options = self.cmd.parse_cli(argv) self.assertEqual(options.log_level_console, "DEBUG_TEST", "Should be debug test") # other usage section self.create_ini(env='DEV') options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "DEV", "The config.ini shoud link to DEV") # user config.ini override conf = os.path.join(self.cmd.default_home, 'config.ini') self.create_ini(conf, "PROD") options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "PROD", "The config.ini shoud link to PROD") self.clean_ini(conf) options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "DEV", "The config.ini shoud link to DEV") self.clean_ini() finally: clean_dir(self.cmd.default_home)
def test_default_override(self): self.cmd.default_home = tempfile.mkdtemp("config", dir=self.tmpdir) try: self.clean_ini() argv = ["ndrive", "console", "--log-level-console", "DEBUG_TEST"] # Default value options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "INFO", "The official default is INFO") # Normal arg options = self.cmd.parse_cli(argv) self.assertEqual(options.log_level_console, "DEBUG_TEST", "Should be debug test") # config.ini override self.create_ini() options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "PROD", "The config.ini shoud link to PROD") # config.ini override, but arg specified options = self.cmd.parse_cli(argv) self.assertEqual(options.log_level_console, "DEBUG_TEST", "Should be debug test") # other usage section self.create_ini(env='DEV') options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "DEV", "The config.ini shoud link to DEV") # user config.ini override conf = os.path.join(self.cmd.default_home, 'config.ini') self.create_ini(conf, "PROD") options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "PROD", "The config.ini shoud link to PROD") self.clean_ini(conf) options = self.cmd.parse_cli([]) self.assertEqual(options.log_level_console, "DEV", "The config.ini shoud link to DEV") self.clean_ini() finally: clean_dir(self.cmd.default_home)
def tearDownApp(self, server_profile=None): if self.tearedDown: return if sys.exc_info() != (None, None, None): self.generate_report() elif self.result is not None: if hasattr(self.result, "wasSuccessful") and not self.result.wasSuccessful(): self.generate_report() log.debug("TearDown unit test") # Unbind all self.manager_1.unbind_all() self.manager_1.dispose_db() self.manager_2.unbind_all() self.manager_2.dispose_db() Manager._singleton = None self.tearDownServer(server_profile) clean_dir(self.upload_tmp_dir) clean_dir(self.local_test_folder_1) clean_dir(self.local_test_folder_2) if getattr(self, 'engine_1', None): del self.engine_1 self.engine_1 = None if getattr(self, 'engine_2', None): del self.engine_2 self.engine_2 = None if getattr(self, 'local_client_1', None): del self.local_client_1 self.local_client_1 = None if getattr(self, 'local_client_2', None): del self.local_client_2 self.local_client_2 = None if getattr(self, 'remote_document_client_1', None): del self.remote_document_client_1 self.remote_document_client_1 = None if getattr(self, 'remote_document_client_2', None): del self.remote_document_client_2 self.remote_document_client_2 = None if getattr(self, 'remote_file_system_client_1', None): del self.remote_file_system_client_1 self.remote_file_system_client_1 = None if getattr(self, 'remote_file_system_client_2', None): del self.remote_file_system_client_2 self.remote_file_system_client_2 = None self.tearedDown = True
def tearDownApp(self, server_profile=None): if self.tearedDown: return import sys if sys.exc_info() != (None, None, None): self.generate_report() elif self.result is not None: if hasattr(self.result, "wasSuccessful") and not self.result.wasSuccessful(): self.generate_report() log.debug("TearDown unit test") # Unbind all self.manager_1.unbind_all() self.manager_1.dispose_db() self.manager_2.unbind_all() self.manager_2.dispose_db() Manager._singleton = 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) clean_dir(self.upload_tmp_dir) clean_dir(self.local_test_folder_1) clean_dir(self.local_test_folder_2) del self.engine_1 self.engine_1 = None del self.engine_2 self.engine_2 = None del self.local_client_1 self.local_client_1 = None del self.local_client_2 self.local_client_2 = None del self.remote_document_client_1 self.remote_document_client_1 = None del self.remote_document_client_2 self.remote_document_client_2 = None del self.remote_file_system_client_1 self.remote_file_system_client_1 = None del self.remote_file_system_client_2 self.remote_file_system_client_2 = None self.tearedDown = True
def tearDownApp(self, server_profile=None): if self.tearedDown: return if sys.exc_info() != (None, None, None): self.generate_report() elif self.result is not None: if hasattr(self.result, "wasSuccessful") and not self.result.wasSuccessful(): self.generate_report() log.debug("TearDown unit test") # Unbind all self.manager_1.unbind_all() self.manager_1.dispose_db() self.manager_2.unbind_all() self.manager_2.dispose_db() Manager._singleton = None self.tearDownServer(server_profile) clean_dir(self.upload_tmp_dir) clean_dir(self.local_test_folder_1) clean_dir(self.local_test_folder_2) del self.engine_1 self.engine_1 = None del self.engine_2 self.engine_2 = None del self.local_client_1 self.local_client_1 = None del self.local_client_2 self.local_client_2 = None del self.remote_document_client_1 self.remote_document_client_1 = None del self.remote_document_client_2 self.remote_document_client_2 = None del self.remote_file_system_client_1 self.remote_file_system_client_1 = None del self.remote_file_system_client_2 self.remote_file_system_client_2 = None self.tearedDown = True
def tearDown(self): # Remove singleton self.manager.dispose_db() Manager._singleton = None clean_dir(self.folder)
def teardown_temp_folder(): clean_dir(LOCAL_TEST_FOLDER)
def tearDown(self): Manager._singleton = None clean_dir(self.test_folder)
def tearDown(self): self.manager.unbind_all() self.manager.dispose_all() Manager._singleton = None clean_dir(self.local_test_folder)