~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to test/engine/test_parseconnect.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-10-28 22:29:40 UTC
  • mfrom: (1.4.24)
  • Revision ID: package-import@ubuntu.com-20131028222940-wvyqffl4g617caun
Tags: 0.8.3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        for text in (
17
17
            'dbtype://username:password@hostspec:110//usr/db_file.db',
18
18
            'dbtype://username:password@hostspec/database',
 
19
            'dbtype+apitype://username:password@hostspec/database',
19
20
            'dbtype://username:password@hostspec',
20
21
            'dbtype://username:password@/database',
21
22
            'dbtype://username@hostspec',
23
24
            'dbtype://hostspec/database',
24
25
            'dbtype://hostspec',
25
26
            'dbtype://hostspec/?arg1=val1&arg2=val2',
26
 
            'dbtype:///database',
 
27
            'dbtype+apitype:///database',
27
28
            'dbtype:///:memory:',
28
29
            'dbtype:///foo/bar/im/a/file',
29
30
            'dbtype:///E:/work/src/LEM/db/hello.db',
30
31
            'dbtype:///E:/work/src/LEM/db/hello.db?foo=bar&hoho=lala',
31
32
            'dbtype://',
32
 
            'dbtype://username:password@/db',
33
 
            'dbtype:////usr/local/mailman/lists/_xtest@example.com/memb'
34
 
                'ers.db',
35
 
            'dbtype://username:apples%2Foranges@hostspec/mydatabase',
 
33
            'dbtype://username:password@/database',
 
34
            'dbtype:////usr/local/_xtest@example.com/members.db',
 
35
            'dbtype://username:apples%2Foranges@hostspec/database',
 
36
            'dbtype://username:password@[2001:da8:2004:1000:202:116:160:90]/database?foo=bar',
 
37
            'dbtype://username:password@[2001:da8:2004:1000:202:116:160:90]:80/database?foo=bar'
36
38
            ):
37
39
            u = url.make_url(text)
38
 
            assert u.drivername == 'dbtype'
39
 
            assert u.username == 'username' or u.username is None
40
 
            assert u.password == 'password' or u.password \
41
 
                == 'apples/oranges' or u.password is None
42
 
            assert u.host == 'hostspec' or u.host == '127.0.0.1' \
43
 
                or not u.host
44
 
            assert str(u) == text
 
40
 
 
41
            assert u.drivername in ('dbtype', 'dbtype+apitype')
 
42
            assert u.username in ('username', None)
 
43
            assert u.password in ('password', 'apples/oranges', None)
 
44
            assert u.host in ('hostspec', '127.0.0.1',
 
45
                        '2001:da8:2004:1000:202:116:160:90', '', None), u.host
 
46
            assert u.database in ('database',
 
47
                    '/usr/local/_xtest@example.com/members.db',
 
48
                    '/usr/db_file.db', ':memory:', '',
 
49
                    'foo/bar/im/a/file',
 
50
                    'E:/work/src/LEM/db/hello.db', None), u.database
 
51
            eq_(str(u), text)
45
52
 
46
53
class DialectImportTest(fixtures.TestBase):
47
54
    def test_import_base_dialects(self):
278
285
        assert e.url.drivername == e2.url.drivername == 'mysql'
279
286
        assert e.url.username == e2.url.username == 'scott'
280
287
        assert e2.url is u
 
288
        assert str(u) == 'mysql://scott:tiger@localhost/test'
 
289
        assert repr(u) == 'mysql://scott:***@localhost/test'
 
290
        assert repr(e) == 'Engine(mysql://scott:***@localhost/test)'
 
291
        assert repr(e2) == 'Engine(mysql://scott:***@localhost/test)'
281
292
 
282
293
    def test_poolargs(self):
283
294
        """test that connection pool args make it thru"""