def test_qurl_from_user_input(user_input, output): """Test qurl_from_user_input. Args: user_input: The string to pass to qurl_from_user_input. output: The expected QUrl string. """ url = urlutils.qurl_from_user_input(user_input) assert url.toString() == output
def download(self, url, dest=None): """Download a given URL, given as string. Args: url: The URL to download dest: The file path to write the download to, or None to ask. """ url = urlutils.qurl_from_user_input(url) urlutils.raise_cmdexc_if_invalid(url) self.get(url, filename=dest)
def download(self, url=None, dest=None): """Download a given URL, or current page if no URL given. Args: url: The URL to download. If not given, download the current page. dest: The file path to write the download to, or None to ask. """ download_manager = objreg.get('download-manager', scope='window', window=self._win_id) if url: url = urlutils.qurl_from_user_input(url) urlutils.raise_cmdexc_if_invalid(url) download_manager.get(url, filename=dest) else: page = self._current_widget().page() download_manager.get(self._current_url(), page)
def test_ipv6_http(self): """Test an IPv6 with http:// and brackets.""" self.assertEqual( urlutils.qurl_from_user_input('http://[::1]').toString(), 'http://[::1]')
def test_ipv6_bare(self): """Test an IPv6 without brackets.""" self.assertEqual( urlutils.qurl_from_user_input('::1/foo').toString(), 'http://[::1]/foo')
def test_url_http(self): """Test a normal URL with http://.""" self.assertEqual( urlutils.qurl_from_user_input('http://qutebrowser.org').toString(), 'http://qutebrowser.org')
def test_ipv6_bare(self): """Test an IPv6 without brackets.""" self.assertEqual(urlutils.qurl_from_user_input('::1/foo').toString(), 'http://[::1]/foo')
def test_ipv6_http(self): """Test an IPv6 with http:// and brackets.""" url = urlutils.qurl_from_user_input('http://[::1]') assert url.toString() == 'http://[::1]'
def test_ipv6(self): """Test an IPv6 with brackets.""" url = urlutils.qurl_from_user_input('[::1]/foo') assert url.toString() == 'http://[::1]/foo'
def test_url_http(self): """Test a normal URL with http://.""" url = urlutils.qurl_from_user_input('http://qutebrowser.org') assert url.toString() == 'http://qutebrowser.org'