cubicweb/test/unittest_utils.py
changeset 12032 c16c1805e973
parent 11917 c38e13988c10
child 12303 198cb7d7b4ac
child 12874 cc71a801b846
equal deleted inserted replaced
12031:92da3e6cb104 12032:c16c1805e973
    31 from six.moves import range
    31 from six.moves import range
    32 
    32 
    33 from cubicweb import Binary, Unauthorized
    33 from cubicweb import Binary, Unauthorized
    34 from cubicweb.devtools.testlib import CubicWebTC
    34 from cubicweb.devtools.testlib import CubicWebTC
    35 from cubicweb.utils import (make_uid, UStringIO, RepeatList, HTMLHead,
    35 from cubicweb.utils import (make_uid, UStringIO, RepeatList, HTMLHead,
    36                             QueryCache, parse_repo_uri)
    36                             QueryCache)
    37 from cubicweb.entity import Entity
    37 from cubicweb.entity import Entity
    38 
    38 
    39 try:
    39 try:
    40     from cubicweb.utils import CubicWebJsonEncoder, json
    40     from cubicweb.utils import CubicWebJsonEncoder, json
    41 except ImportError:
    41 except ImportError:
    55                 self.fail(len(d))
    55                 self.fail(len(d))
    56             if re.match('\d', uid):
    56             if re.match('\d', uid):
    57                 self.fail('make_uid must not return something begining with '
    57                 self.fail('make_uid must not return something begining with '
    58                           'some numeric character, got %s' % uid)
    58                           'some numeric character, got %s' % uid)
    59             d.add(uid)
    59             d.add(uid)
    60 
       
    61 
       
    62 class TestParseRepoUri(TestCase):
       
    63 
       
    64     def test_parse_repo_uri(self):
       
    65         self.assertEqual(('inmemory', None, 'myapp'),
       
    66                          parse_repo_uri('myapp'))
       
    67         self.assertEqual(('inmemory', None, 'myapp'),
       
    68                          parse_repo_uri('inmemory://myapp'))
       
    69         with self.assertRaises(NotImplementedError):
       
    70             parse_repo_uri('foo://bar')
       
    71 
       
    72 
    60 
    73 
    61 
    74 class TestQueryCache(TestCase):
    62 class TestQueryCache(TestCase):
    75     def test_querycache(self):
    63     def test_querycache(self):
    76         c = QueryCache(ceiling=20)
    64         c = QueryCache(ceiling=20)