Style fixes.

This commit is contained in:
Imran Sobir 2017-02-09 15:44:51 +05:00
parent 828b0c00b5
commit 4eccfd5396

View File

@ -17,20 +17,23 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import datetime
import tempfile
from PyQt5.QtCore import QUrl
import pytest
from qutebrowser.browser import history, qutescheme
from qutebrowser.utils import objreg
import datetime
import pytest
import tempfile
class TestHistoryHandler:
"""Test the qute://history endpoint."""
@pytest.fixture(autouse=True)
def fake_objects(self, fake_save_manager):
""" Create fake web-history with history for three different days """
"""Create fake web-history with history for three different days."""
try:
original_save_manager = objreg.get('save-manager')
except KeyError:
@ -78,14 +81,14 @@ class TestHistoryHandler:
objreg.delete('web-history')
def test_history_without_query(self):
""" Test qute://history shows today's history when it has no query """
"""Ensure qute://history shows today's history when it has no query."""
_mimetype, data = qutescheme.qute_history(QUrl("qute://history"))
key = "<span class=\"date\">{}</span>".format(
datetime.date.today().strftime("%a, %d %B %Y"))
assert key in data
def test_history_with_bad_query(self):
""" Test qute://history shows today's history when given bad query """
"""Ensure qute://history shows today's history when given bad query."""
url = QUrl("qute://history?date=204-blaah")
_mimetype, data = qutescheme.qute_history(url)
key = "<span class=\"date\">{}</span>".format(
@ -93,7 +96,7 @@ class TestHistoryHandler:
assert key in data
def test_history_today(self):
""" Test qute://history shows history for today """
"""Ensure qute://history shows history for today."""
url = QUrl("qute://history")
_mimetype, data = qutescheme.qute_history(url)
assert "today" in data
@ -101,7 +104,7 @@ class TestHistoryHandler:
assert "yesterday" not in data
def test_history_yesterday(self):
""" Test qute://history shows history for yesterday """
"""Ensure qute://history shows history for yesterday."""
url = QUrl("qute://history?date=" + self.prev_date.strftime("%Y-%m-%d"))
_mimetype, data = qutescheme.qute_history(url)
assert "today" not in data
@ -109,7 +112,7 @@ class TestHistoryHandler:
assert "yesterday" in data
def test_history_tomorrow(self):
""" Test qute://history shows history for tomorrow """
"""Ensure qute://history shows history for tomorrow."""
url = QUrl("qute://history?date=" + self.next_date.strftime("%Y-%m-%d"))
_mimetype, data = qutescheme.qute_history(url)
assert "today" not in data