18
18
':pass@' ,
19
19
'u:p@h' ,
20
20
'u:p@h:1' ,
21
+ 'postgres://host/database' ,
21
22
'pq://user:password@host:port/database?setting=value#public,private' ,
22
23
'pq://fæm.com:123/õéf/á?param=val' ,
23
24
'pq://l»»@fæm.com:123/õéf/á?param=val' ,
84
85
]
85
86
86
87
class test_iri (unittest .TestCase ):
88
+ def testAlternateSchemes (self ):
89
+ field = pg_iri .parse ("postgres://host" )['host' ]
90
+ self .assertEqual (field , 'host' )
91
+
92
+ field = pg_iri .parse ("postgresql://host" )['host' ]
93
+ self .assertEqual (field , 'host' )
94
+
95
+ try :
96
+ pg_iri .parse ("reject://host" )
97
+ except ValueError :
98
+ pass
99
+ else :
100
+ self .fail ("unacceptable IRI scheme not rejected" )
101
+
87
102
def testIP6Hosts (self ):
88
103
"""
89
104
Validate that IPv6 hosts are properly extracted.
@@ -101,15 +116,19 @@ def testIP6Hosts(self):
101
116
self .assertEqual (p ['host' ], h )
102
117
103
118
def testPresentPasswordObscure (self ):
104
- "password is present in IRI, and obscure it"
119
+ """
120
+ Password is present in IRI, and obscure it.
121
+ """
105
122
s = 'pq://user:pass@host:port/dbname'
106
123
o = 'pq://user:***@host:port/dbname'
107
124
p = pg_iri .parse (s )
108
125
ps = pg_iri .serialize (p , obscure_password = True )
109
126
self .assertEqual (ps , o )
110
127
111
128
def testPresentPasswordObscure (self ):
112
- "password is *not* present in IRI, and do nothing"
129
+ """
130
+ Password is *not* present in IRI, and do nothing.
131
+ """
113
132
s = 'pq://user@host:port/dbname'
114
133
o = 'pq://user@host:port/dbname'
115
134
p = pg_iri .parse (s )
0 commit comments