예제 #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
예제 #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
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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]')
예제 #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')
예제 #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')
예제 #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]')
예제 #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')
예제 #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')
예제 #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]'
예제 #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'
예제 #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'