def test_get_plugin_directory(self): temp_path = os.path.realpath(os.tempnam()) CONF.set_override('working_directory', temp_path) plugin_name = 'my_test_plugin' plugin_path = os.path.join(CONF.working_directory, 'plugin', plugin_name) self.assertFalse(os.path.exists(CONF.working_directory)) self.assertFalse(os.path.exists(plugin_path)) resolved_path = working_dir.get_plugin_directory(plugin_name) self.assertEqual(plugin_path, resolved_path) self.assertTrue(os.path.exists(CONF.working_directory)) self.assertTrue(os.path.exists(plugin_path)) self.assertTrue(os.access(CONF.working_directory, os.W_OK)) self.assertTrue(os.access(plugin_path, os.W_OK)) shutil.rmtree(temp_path) CONF.clear_override('working_directory') working_dir.WORKING_DIRECTORY = None
def test_get_plugin_directory(self): temp_path = os.path.realpath(os.tempnam()) CONF.set_override('working_directory', temp_path) plugin_name = 'my_test_plugin' plugin_path = os.path.join(CONF.working_directory, 'plugin', plugin_name) self.assertFalse(os.path.exists(CONF.working_directory)) self.assertFalse(os.path.exists(plugin_path)) resolved_path = working_dir.get_plugin_directory(plugin_name) self.assertEqual(plugin_path, resolved_path) self.assertTrue(os.path.exists(CONF.working_directory)) self.assertTrue(os.path.exists(plugin_path)) self.assertTrue(os.access(CONF.working_directory, os.W_OK)) self.assertTrue(os.access(plugin_path, os.W_OK)) shutil.rmtree(temp_path) CONF.clear_override('working_directory') working_dir.WORKING_DIRECTORY = None
def get_email_directory(): """A shared utility method that always provides the same working directory. Error handling is explicitly not provided, as the methods used 'should' be consistent about the errors they themselves raise. """ return get_plugin_directory("email")
def get_email_directory(): """A shared utility method that always provides the same working directory. Error handling is explicitly not provided, as the methods used 'should' be consistent about the errors they themselves raise. """ return get_plugin_directory("email")