summaryrefslogtreecommitdiff
path: root/oslo_config/tests/test_types.py
diff options
context:
space:
mode:
authorMasaki Matsushita <glass.saga@gmail.com>2015-09-28 20:28:28 +0900
committerMasaki Matsushita <glass.saga@gmail.com>2016-06-17 13:39:39 +0900
commit45ee2bed52a57b9801435b43ad45d8f50204580d (patch)
tree322a2712dc645c62b3be78149b23d332aa78bfa9 /oslo_config/tests/test_types.py
parentbb0f7e3880bd83dbb9088f3f8045152ce8e7897b (diff)
downloadoslo-config-45ee2bed52a57b9801435b43ad45d8f50204580d.tar.gz
Add URIOpt
This change add URIOpt which validates string as URI. Closes-Bug: #1500398 Change-Id: Ie8736b8654b9feb2a2b174159f08dbea03568d84
Diffstat (limited to 'oslo_config/tests/test_types.py')
-rw-r--r--oslo_config/tests/test_types.py12
1 files changed, 12 insertions, 0 deletions
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()))