From db7ccb04341afb1de5e86b7fd99be97cc7ea8bee Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 6 Mar 2018 13:26:22 +0100 Subject: Update config tests for pattern changes --- tests/unit/config/test_configcommands.py | 7 ++++--- tests/unit/config/test_configfiles.py | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py index 4a09b5be2..80328a22d 100644 --- a/tests/unit/config/test_configcommands.py +++ b/tests/unit/config/test_configcommands.py @@ -107,9 +107,10 @@ class TestSet: monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebKit) option = 'content.javascript.enabled' - with pytest.raises(cmdexc.CommandError, - match='Error while parsing :/: No scheme given'): - commands.set(0, option, 'false', pattern=':/') + with pytest.raises( + cmdexc.CommandError, + match='Error while parsing http://: Pattern without host'): + commands.set(0, option, 'false', pattern='http://') def test_set_no_pattern(self, monkeypatch, commands): """Run ':set --pattern=*://* colors.statusbar.normal.bg #abcdef. diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index 186b3cd55..d3b3f5726 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -301,7 +301,8 @@ class TestYaml: ('settings: {"content.images": 42}\nconfig_version: 2', "While parsing 'content.images'", "value is not a dict"), ('settings: {"content.images": {"https://": true}}\nconfig_version: 2', - "While parsing pattern 'https://' for 'content.images'", "Pattern without host"), + "While parsing pattern 'https://' for 'content.images'", + "Pattern without host"), ('settings: {"content.images": {true: true}}\nconfig_version: 2', "While parsing 'content.images'", "pattern is not of type string"), ]) @@ -737,11 +738,11 @@ class TestConfigPy: assert str(error.exception) == expected @pytest.mark.parametrize('line, text', [ - ('config.get("content.images", "://")', + ('config.get("content.images", "http://")', "While getting 'content.images' and parsing pattern"), - ('config.set("content.images", False, "://")', + ('config.set("content.images", False, "http://")', "While setting 'content.images' and parsing pattern"), - ('with config.pattern("://"): pass', + ('with config.pattern("http://"): pass', "Unhandled exception"), ]) def test_invalid_pattern(self, confpy, line, text): @@ -750,7 +751,7 @@ class TestConfigPy: assert error.text == text assert isinstance(error.exception, urlmatch.ParseError) - assert str(error.exception) == "No scheme given" + assert str(error.exception) == "Pattern without host" def test_multiple_errors(self, confpy): confpy.write("c.foo = 42", "config.set('foo', 42)", "1/0") -- cgit v1.2.3-54-g00ecf