diff options
Diffstat (limited to 'tests/unit/completion/test_histcategory.py')
-rw-r--r-- | tests/unit/completion/test_histcategory.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/completion/test_histcategory.py b/tests/unit/completion/test_histcategory.py index 8fd48f429..7dfda3ea6 100644 --- a/tests/unit/completion/test_histcategory.py +++ b/tests/unit/completion/test_histcategory.py @@ -20,11 +20,13 @@ """Test the web history completion category.""" import datetime +import logging import pytest from qutebrowser.misc import sql from qutebrowser.completion.models import histcategory +from qutebrowser.utils import usertypes @pytest.fixture @@ -133,6 +135,18 @@ def test_set_pattern_repeated(model_validator, hist): ]) +def test_set_pattern_long(hist, message_mock, caplog): + hist.insert({'url': 'example.com/foo', 'title': 'title1', 'last_atime': 1}) + cat = histcategory.HistoryCategory() + with caplog.at_level(logging.ERROR): + # pylint: disable=bad-builtin + cat.set_pattern(" ".join(map(str, range(10000)))) + # pylint: enable=bad-builtin + msg = message_mock.getmsg(usertypes.MessageLevel.error) + assert msg.text.startswith( + "Error building SQL Query: Expression tree is too large") + + @pytest.mark.parametrize('max_items, before, after', [ (-1, [ ('a', 'a', '2017-04-16'), |