def test_github_extension_release_download_url_is_valid(self): ext = get_extension(_KNOWN_GITHUB_EXTENSION_UID, release='0.27.0', tunnel=_TUNNEL) url = ext.download_url self.assertIsNotNone(url) self.assertEqual(github_get(url), 200)
def test_marketplace_extension_download_url_is_valid(self): e = get_extension(_KNOWN_MARKETPLACE_EXTENSION_UID, tunnel=_tunnel) url = e.download_url self.assertIsNotNone(url) response = requests.head(url, allow_redirects=True) self.assertEqual(response.status_code, 200)
def test_github_extension_invalid_release_download_url_is_not_found(self): e = get_extension(_KNOWN_GITHUB_EXTENSION_UID, release='0.0.0', tunnel=_tunnel) url = e.download_url self.assertIsNotNone(url) self.assertEqual(github_get(url), 404)
def _install_extensions(self, target_editors, extensions): """ Install any requested extensions. For each extension, download the extension, then install the extension to each of the target code editors. Arguments: target_editors {set} -- A set of the names of target editors. extensions {set} -- A set of extensions to download and install. """ remote_output = Command.main_options.remote_output_dir local_output = Command.main_options.output_dir for req in extensions: ext = get_extension(req, tunnel=Command.tunnel) # get a list of any extension paths added as a result of downloading this extension. # This is a list an not a string, because the extension we download may have been an # extension pack or it may have dependencies. This means that mutliple downloads may # result from downloading this single extension. In that case, we'll need to install # each of the downloaded extensions. # # In the case that this is an extension with no dependencies, then we'll just # receive a list having one path in it. extension_paths = ext.download(remote_output, local_output) # Install the extension at each path to each of the target editors. for path in extension_paths: for editor_name in target_editors: editor = self.system_editors[editor_name] editor.install_extension(path) # add the extension to the list of temporary files to remove # once all processing has finished. self.store_temporary_file_path(path)
def test_marketplace_extension_is_extension(self): e = get_extension(_KNOWN_MARKETPLACE_EXTENSION_UID, tunnel=_tunnel) self.assertIsInstance(e, Extension) self.assertTrue(e.should_download_from_marketplace)
def test_github_extension_latest_download_url_is_valid(self): e = get_extension(_KNOWN_GITHUB_EXTENSION_UID, tunnel=_tunnel) url = e.download_url self.assertIsNotNone(url) self.assertEqual(github_get(url), 200)
def test_github_extension_is_recognized(self): e = get_extension(_KNOWN_GITHUB_EXTENSION_UID, tunnel=_tunnel) self.assertIsInstance(e, GithubExtension) self.assertFalse(e.should_download_from_marketplace)
def test_marketplace_extension_is_recognized(self): ext = get_extension(_KNOWN_MARKETPLACE_EXTENSION_UID, tunnel=_TUNNEL) self.assertIsInstance(ext, MarketplaceExtension) self.assertTrue(ext.should_download_from_marketplace)
def test_github_extension_is_extension(self): ext = get_extension(_KNOWN_GITHUB_EXTENSION_UID, tunnel=_TUNNEL) self.assertIsInstance(ext, Extension) self.assertFalse(ext.should_download_from_marketplace)