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',
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',
32
'dbtype://username:password@/db',
33
'dbtype:////usr/local/mailman/lists/_xtest@example.com/memb'
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'
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' \
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:', '',
50
'E:/work/src/LEM/db/hello.db', None), u.database
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)'
282
293
def test_poolargs(self):
283
294
"""test that connection pool args make it thru"""