From 45ee2bed52a57b9801435b43ad45d8f50204580d Mon Sep 17 00:00:00 2001 From: Masaki Matsushita Date: Mon, 28 Sep 2015 20:28:28 +0900 Subject: Add URIOpt This change add URIOpt which validates string as URI. Closes-Bug: #1500398 Change-Id: Ie8736b8654b9feb2a2b174159f08dbea03568d84 --- oslo_config/tests/test_types.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'oslo_config/tests/test_types.py') diff --git a/oslo_config/tests/test_types.py b/oslo_config/tests/test_types.py index e306f04..632c3d9 100644 --- a/oslo_config/tests/test_types.py +++ b/oslo_config/tests/test_types.py @@ -637,3 +637,15 @@ class HostnameTypeTests(TypeTestHelper, unittest.TestCase): self.assertEqual(255, len(test_str)) self.assertInvalid(test_str) self.assertConvertedEqual(test_str[:-2]) + + +class URITypeTests(TypeTestHelper, unittest.TestCase): + type = types.URI() + + def test_uri(self): + self.assertConvertedValue('http://example.com', 'http://example.com') + self.assertInvalid('invalid') # it doesn't include a scheme + self.assertInvalid('http://') # it doesn't include an authority + + def test_repr(self): + self.assertEqual('URI', repr(types.URI())) -- cgit v1.2.1