def test_get_url_https(self): plugin = {'source': 'https://google.com', 'install_arguments': '--pre'} url = installer.get_plugin_source(plugin) args = installer.get_plugin_args(plugin) self.assertEqual(url, 'https://google.com') self.assertEqual(args, '--pre')
def test_get_url_https(): plugin = {'source': 'https://google.com', 'install_arguments': '--pre'} url = installer.get_plugin_source(plugin) args = installer.get_plugin_args(plugin) assert url == 'https://google.com' assert args == ['--pre']
def test_get_plugin_source_from_blueprints_dir(self): plugin = {'source': 'plugin-dir-name'} with test_utils.env( constants.MANAGER_FILE_SERVER_BLUEPRINTS_ROOT_URL_KEY, 'localhost'): source = installer.get_plugin_source(plugin, blueprint_id='blueprint_id') self.assertEqual('localhost/blueprint_id/plugins/plugin-dir-name.zip', source)
def test_get_plugin_source_from_blueprints_dir(): plugin = {'source': 'plugin-dir-name'} file_path = '/tmp/plugin-dir-name.zip' with patch('cloudify.plugin_installer.ctx', **{'download_resource.return_value': file_path}): source = installer.get_plugin_source(plugin, blueprint_id='blueprint_id') prefix = 'file:///C:' if os.name == 'nt' else 'file://' expected = '{0}{1}'.format(prefix, file_path) assert expected == source
def test_get_plugin_source_from_blueprints_dir(self): plugin = {'source': 'plugin-dir-name'} with patch( 'cloudify_agent.api.plugins.installer.ctx', **{ 'download_resource.return_value': '/tmp/plugin-dir-name.zip' }): source = installer.get_plugin_source(plugin, blueprint_id='blueprint_id') self.assertEqual('file:///tmp/plugin-dir-name.zip', source)
def test_get_plugin_source_from_blueprints_dir(self): plugin = { 'source': 'plugin-dir-name' } with patch('cloudify_agent.api.plugins.installer.ctx', **{ 'download_resource.return_value': '/tmp/plugin-dir-name.zip'}): source = installer.get_plugin_source( plugin, blueprint_id='blueprint_id') self.assertEqual('file:///tmp/plugin-dir-name.zip', source)
def test_get_url_https(self): plugin = { 'source': 'https://google.com', 'install_arguments': '--pre' } url = installer.get_plugin_source(plugin) args = installer.get_plugin_args(plugin) self.assertEqual(url, 'https://google.com') self.assertEqual(args, '--pre')
def test_get_plugin_source_from_blueprints_dir(self): plugin = { 'source': 'plugin-dir-name' } file_path = '/tmp/plugin-dir-name.zip' with patch('cloudify_agent.api.plugins.installer.ctx', **{'download_resource.return_value': file_path}): source = installer.get_plugin_source( plugin, blueprint_id='blueprint_id') prefix = 'file:///C:' if os.name == 'nt' else 'file://' expected = '{0}{1}'.format(prefix, file_path) self.assertEqual(expected, source)
def test_get_plugin_source_from_blueprints_dir(self): plugin = { 'source': 'plugin-dir-name' } with test_utils.env( constants.MANAGER_FILE_SERVER_BLUEPRINTS_ROOT_URL_KEY, 'localhost'): source = installer.get_plugin_source( plugin, blueprint_id='blueprint_id') self.assertEqual( 'localhost/blueprint_id/plugins/plugin-dir-name.zip', source)
def test_get_url_and_args_http_no_args(): plugin = {'source': 'http://google.com'} url = installer.get_plugin_source(plugin) args = installer.get_plugin_args(plugin) assert url == 'http://google.com' assert args == []
def test_get_url_and_args_http_no_args(self): plugin = {'source': 'http://google.com'} url = installer.get_plugin_source(plugin) args = installer.get_plugin_args(plugin) self.assertEqual(url, 'http://google.com') self.assertEqual(args, '')