From b3755f4ca14810aa787e20c0e2a5d1078ecd6d8c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 23 Jul 2015 23:53:17 +0200 Subject: [PATCH] configtypes: Add tests for SessionName. --- tests/config/test_configtypes.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/config/test_configtypes.py b/tests/config/test_configtypes.py index 66e7e8a8a..8923d24d9 100644 --- a/tests/config/test_configtypes.py +++ b/tests/config/test_configtypes.py @@ -1661,6 +1661,24 @@ class TestUrlList: assert klass().transform(val) == expected +class TestSessionName: + + """Test SessionName.""" + + @pytest.fixture + def klass(self): + return configtypes.SessionName + + @pytest.mark.parametrize('val', ['', 'foobar']) + def test_validate_valid(self, klass, val): + klass(none_ok=True).validate(val) + + @pytest.mark.parametrize('val', ['', '_foo']) + def test_validate_invalid(self, klass, val): + with pytest.raises(configexc.ValidationError): + klass().validate(val) + + class TestFormatString: """Test FormatString."""