test/unittest_utils.py
changeset 8682 20bd1cdf86ae
parent 7954 a3d3220669d6
child 9599 13dd3a57dabb
--- a/test/unittest_utils.py	Wed Jan 23 17:58:49 2013 +0100
+++ b/test/unittest_utils.py	Fri Jan 25 13:28:23 2013 +0100
@@ -26,7 +26,7 @@
 
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.utils import (make_uid, UStringIO, SizeConstrainedList,
-                            RepeatList, HTMLHead, QueryCache)
+                            RepeatList, HTMLHead, QueryCache, parse_repo_uri)
 from cubicweb.entity import Entity
 
 try:
@@ -50,6 +50,25 @@
                           'some numeric character, got %s' % uid)
             d.add(uid)
 
+
+class TestParseRepoUri(TestCase):
+
+    def test_parse_repo_uri(self):
+        self.assertEqual(('inmemory', None, 'myapp'),
+                         parse_repo_uri('myapp'))
+        self.assertEqual(('inmemory', None, 'myapp'),
+                         parse_repo_uri('inmemory://myapp'))
+        self.assertEqual(('pyro', 'pyro-ns-host:pyro-ns-port', '/myapp'),
+                         parse_repo_uri('pyro://pyro-ns-host:pyro-ns-port/myapp'))
+        self.assertEqual(('pyroloc', 'host:port', '/appkey'),
+                         parse_repo_uri('pyroloc://host:port/appkey'))
+        self.assertEqual(('zmqpickle-tcp', '127.0.0.1:666', ''),
+                         parse_repo_uri('zmqpickle-tcp://127.0.0.1:666'))
+        with self.assertRaises(NotImplementedError):
+            parse_repo_uri('foo://bar')
+
+
+
 class TestQueryCache(TestCase):
     def test_querycache(self):
         c = QueryCache(ceiling=20)