summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Schwab <git@nicholas-schwab.de>2021-04-09 16:40:51 +0200
committerNicholas Schwab <git@nicholas-schwab.de>2021-04-09 16:40:51 +0200
commit22884268c2b50651960633bc4a5a7255a43cd79e (patch)
tree146facbcf6031a897e7e3288dc9a2e3c8ade3b59
parent07b7bbe3a3af6a12bcc79a1381377d0265c46276 (diff)
downloadqutebrowser-22884268c2b50651960633bc4a5a7255a43cd79e.tar.gz
qutebrowser-22884268c2b50651960633bc4a5a7255a43cd79e.zip
Added tests for StatusbarWidget.
-rw-r--r--tests/unit/config/test_configtypes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py
index 28c52a1e0..3e1d15099 100644
--- a/tests/unit/config/test_configtypes.py
+++ b/tests/unit/config/test_configtypes.py
@@ -2117,6 +2117,24 @@ class TestUrlPattern:
klass().to_py('http://')
+class TestStatusbarWidget:
+
+ @pytest.fixture
+ def klass(self):
+ return configtypes.StatusbarWidget
+
+ @pytest.mark.parametrize('value', ['text:bar', 'foo'])
+ def test_validate_valid_values(self, klass, value):
+ widget = klass(valid_values=configtypes.ValidValues('foo'))
+ assert widget.to_py(value) == value
+
+ @pytest.mark.parametrize('value', ['text', 'foo:bar'])
+ def test_validate_invalid_values(self, klass, value):
+ widget = klass(valid_values=configtypes.ValidValues('foo'))
+ with pytest.raises(configexc.ValidationError):
+ widget.to_py(value)
+
+
@pytest.mark.parametrize('first, second, equal', [
(re.compile('foo'), RegexEq('foo'), True),
(RegexEq('bar'), re.compile('bar'), True),