Fix lint and test

This commit is contained in:
Florian Bruhin 2018-09-04 23:21:51 +02:00
parent 5b8e0d8d80
commit 6293bc5178
3 changed files with 5 additions and 5 deletions

View File

@ -42,7 +42,6 @@ except ImportError:
import pkg_resources import pkg_resources
from PyQt5.QtCore import QUrlQuery, QUrl from PyQt5.QtCore import QUrlQuery, QUrl
from PyQt5.QtNetwork import QNetworkReply
import qutebrowser import qutebrowser
from qutebrowser.config import config, configdata, configexc, configdiff from qutebrowser.config import config, configdata, configexc, configdiff
@ -264,13 +263,13 @@ def qute_history(url):
try: try:
offset = QUrlQuery(url).queryItemValue("offset") offset = QUrlQuery(url).queryItemValue("offset")
offset = int(offset) if offset else None offset = int(offset) if offset else None
except ValueError as e: except ValueError:
raise UrlInvalidError("Query parameter offset is invalid") raise UrlInvalidError("Query parameter offset is invalid")
# Use start_time in query or current time. # Use start_time in query or current time.
try: try:
start_time = QUrlQuery(url).queryItemValue("start_time") start_time = QUrlQuery(url).queryItemValue("start_time")
start_time = float(start_time) if start_time else time.time() start_time = float(start_time) if start_time else time.time()
except ValueError as e: except ValueError:
raise UrlInvalidError("Query parameter start_time is invalid") raise UrlInvalidError("Query parameter start_time is invalid")
return 'text/html', json.dumps(history_data(start_time, offset)) return 'text/html', json.dumps(history_data(start_time, offset))

View File

@ -80,7 +80,8 @@ Feature: Downloading things from a website.
And I open data/downloads/issue1243.html And I open data/downloads/issue1243.html
And I hint with args "links download" and follow a And I hint with args "links download" and follow a
And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> text=* title='Save file to:'>, *" in the log And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> text=* title='Save file to:'>, *" in the log
Then the error "Download error: No handler found for qute://!" should be shown Then the error "Download error: No handler found for qute://" should be shown
And "NotFoundError while handling qute://* URL" should be logged
Scenario: Downloading a data: link (issue 1214) Scenario: Downloading a data: link (issue 1214)
When I set downloads.location.suggestion to filename When I set downloads.location.suggestion to filename

View File

@ -159,7 +159,7 @@ Feature: Special qute:// pages
Scenario: qute://settings CSRF token (webengine) Scenario: qute://settings CSRF token (webengine)
When I open qute://settings When I open qute://settings
And I run :jseval const xhr = new XMLHttpRequest(); xhr.open("GET", "qute://settings/set"); xhr.send() And I run :jseval const xhr = new XMLHttpRequest(); xhr.open("GET", "qute://settings/set"); xhr.send()
Then "Error while handling qute://* URL" should be logged Then "RequestDeniedError while handling qute://* URL" should be logged
And the error "Invalid CSRF token for qute://settings!" should be shown And the error "Invalid CSRF token for qute://settings!" should be shown
@qtwebengine_skip @qtwebengine_skip