Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
 def test_ipv6_http(self):
     """Test an IPv6 with http:// and brackets."""
     self.assertEqual(
         urlutils.qurl_from_user_input('http://[::1]').toString(),
         'http://[::1]')
Exemplo n.º 8
0
 def test_ipv6_bare(self):
     """Test an IPv6 without brackets."""
     self.assertEqual(
         urlutils.qurl_from_user_input('::1/foo').toString(),
         'http://[::1]/foo')
Exemplo n.º 9
0
 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')
Exemplo n.º 10
0
 def test_ipv6_http(self):
     """Test an IPv6 with http:// and brackets."""
     self.assertEqual(
         urlutils.qurl_from_user_input('http://[::1]').toString(),
         'http://[::1]')
Exemplo n.º 11
0
 def test_ipv6_bare(self):
     """Test an IPv6 without brackets."""
     self.assertEqual(urlutils.qurl_from_user_input('::1/foo').toString(),
                      'http://[::1]/foo')
Exemplo n.º 12
0
 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')
Exemplo n.º 13
0
 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]'
Exemplo n.º 14
0
 def test_ipv6(self):
     """Test an IPv6 with brackets."""
     url = urlutils.qurl_from_user_input('[::1]/foo')
     assert url.toString() == 'http://[::1]/foo'
Exemplo n.º 15
0
 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'