| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 23 |
#~ Imports |
|---|
| 24 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 25 |
|
|---|
| 26 |
# Path adjustmet so the test can run out of the box |
|---|
| 27 |
import sys; sys.path.append('..') |
|---|
| 28 |
import unittest |
|---|
| 29 |
|
|---|
| 30 |
from RBFoundation import URIparser |
|---|
| 31 |
|
|---|
| 32 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 33 |
#~ Definitions |
|---|
| 34 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 35 |
|
|---|
| 36 |
class URIPathDefaultTestCase(unittest.TestCase): |
|---|
| 37 |
def verifyURIParts(self, uri, scheme, authority, path, query, fragment): |
|---|
| 38 |
self.failUnlessEqual(uri.scheme, scheme) |
|---|
| 39 |
self.failUnlessEqual(uri.authority, authority) |
|---|
| 40 |
self.failUnlessEqual(uri.path, path) |
|---|
| 41 |
self.failUnlessEqual(uri.query, query) |
|---|
| 42 |
self.failUnlessEqual(uri.fragment, fragment) |
|---|
| 43 |
|
|---|
| 44 |
def testScheme(self): |
|---|
| 45 |
'Path Default: "scheme:"' |
|---|
| 46 |
URIstr = 'scheme:' |
|---|
| 47 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 48 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 49 |
self.verifyURIParts(uri, 'scheme', None, '', None, None) |
|---|
| 50 |
|
|---|
| 51 |
def testPath(self): |
|---|
| 52 |
'Path Default: "path"' |
|---|
| 53 |
URIstr = 'path' |
|---|
| 54 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 55 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 56 |
self.verifyURIParts(uri, None, None, 'path', None, None) |
|---|
| 57 |
|
|---|
| 58 |
def testPathSlash(self): |
|---|
| 59 |
'Path Default: "/path"' |
|---|
| 60 |
URIstr = '/path' |
|---|
| 61 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 62 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 63 |
self.verifyURIParts(uri, None, None, '/path', None, None) |
|---|
| 64 |
|
|---|
| 65 |
def testSchemePath(self): |
|---|
| 66 |
'Path Default: "scheme:path"' |
|---|
| 67 |
URIstr = 'scheme:path' |
|---|
| 68 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 69 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 70 |
self.verifyURIParts(uri, 'scheme', None, 'path', None, None) |
|---|
| 71 |
|
|---|
| 72 |
def testSchemePathSlash(self): |
|---|
| 73 |
'Path Default: "scheme:/path"' |
|---|
| 74 |
URIstr = 'scheme:/path' |
|---|
| 75 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 76 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 77 |
self.verifyURIParts(uri, 'scheme', None, '/path', None, None) |
|---|
| 78 |
|
|---|
| 79 |
def testAuthority(self): |
|---|
| 80 |
'Path Default: "//authority"' |
|---|
| 81 |
URIstr = '//authority' |
|---|
| 82 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 83 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 84 |
self.verifyURIParts(uri, None, 'authority', '', None, None) |
|---|
| 85 |
|
|---|
| 86 |
def testSchemeAuthority(self): |
|---|
| 87 |
'Path Default: "scheme://authority"' |
|---|
| 88 |
URIstr = 'scheme://authority' |
|---|
| 89 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 90 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 91 |
self.verifyURIParts(uri, 'scheme', 'authority', '', None, None) |
|---|
| 92 |
|
|---|
| 93 |
def testAuthorityPath(self): |
|---|
| 94 |
'Path Default: "//authority/path"' |
|---|
| 95 |
URIstr = '//authority/path' |
|---|
| 96 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 97 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 98 |
self.verifyURIParts(uri, None, 'authority', '/path', None, None) |
|---|
| 99 |
|
|---|
| 100 |
def testSchemeAuthorityPath(self): |
|---|
| 101 |
'Path Default: "scheme://authority/path"' |
|---|
| 102 |
URIstr = 'scheme://authority/path' |
|---|
| 103 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 104 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 105 |
self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) |
|---|
| 106 |
|
|---|
| 107 |
def testUserAuthorityPath(self): |
|---|
| 108 |
'Path Default: "//user@authority/path"' |
|---|
| 109 |
URIstr = '//user@authority/path' |
|---|
| 110 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 111 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 112 |
self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) |
|---|
| 113 |
|
|---|
| 114 |
def testSchemeUserAuthorityPath(self): |
|---|
| 115 |
'Path Default: "scheme://user@authority/path"' |
|---|
| 116 |
URIstr = 'scheme://user@authority/path' |
|---|
| 117 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 118 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 119 |
self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) |
|---|
| 120 |
|
|---|
| 121 |
def testSchemeUserAuthorityHostPath(self): |
|---|
| 122 |
'Path Default: "scheme://user@authority:4242/path"' |
|---|
| 123 |
URIstr = 'scheme://user@authority:4242/path' |
|---|
| 124 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 125 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 126 |
self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) |
|---|
| 127 |
|
|---|
| 128 |
def testMailto(self): |
|---|
| 129 |
'Path Default: "mailto:user@host"' |
|---|
| 130 |
URIstr = 'mailto:user@host' |
|---|
| 131 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 132 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 133 |
self.verifyURIParts(uri, 'mailto', None, 'user@host', None, None) |
|---|
| 134 |
|
|---|
| 135 |
def testUserPasswdAuthority(self): |
|---|
| 136 |
'Path Default: "//user:passwd@authority"' |
|---|
| 137 |
URIstr = '//user:passwd@authority' |
|---|
| 138 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 139 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 140 |
self.verifyURIParts(uri, None, 'user:passwd@authority', '', None, None) |
|---|
| 141 |
|
|---|
| 142 |
def testUserPasswdAuthorityHostPath(self): |
|---|
| 143 |
'Path Default: "//user:passwd@authority:4242/path"' |
|---|
| 144 |
URIstr = '//user:passwd@authority:4242/path' |
|---|
| 145 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 146 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 147 |
self.verifyURIParts(uri, None, 'user:passwd@authority:4242', '/path', None, None) |
|---|
| 148 |
|
|---|
| 149 |
def testSchemeUserPasswdAuthorityHostPath(self): |
|---|
| 150 |
'Path Default: "scheme://user:passwd@authority:4242/path"' |
|---|
| 151 |
URIstr = 'scheme://user:passwd@authority:4242/path' |
|---|
| 152 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 153 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 154 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) |
|---|
| 155 |
|
|---|
| 156 |
def testSchemeUserPasswdAuthorityHostPathAttributes(self): |
|---|
| 157 |
'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1"' |
|---|
| 158 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1' |
|---|
| 159 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 160 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 161 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) |
|---|
| 162 |
|
|---|
| 163 |
def testSchemeUserPasswdAuthorityHostPathAttributesQuery(self): |
|---|
| 164 |
'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query"' |
|---|
| 165 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query' |
|---|
| 166 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 167 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 168 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) |
|---|
| 169 |
|
|---|
| 170 |
def testSchemeUserPasswdAuthorityHostPathAttributesQueryFragment(self): |
|---|
| 171 |
'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment"' |
|---|
| 172 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment' |
|---|
| 173 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 174 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 175 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 176 |
|
|---|
| 177 |
def testSchemeNullAuthorityPathAttributesQueryFragment(self): |
|---|
| 178 |
'Path Default: "scheme:///path;attr1=value1?query#fragment"' |
|---|
| 179 |
URIstr = 'scheme:///path;attr1=value1?query#fragment' |
|---|
| 180 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 181 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 182 |
self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 183 |
|
|---|
| 184 |
def testSchemePathAttributesQueryFragment(self): |
|---|
| 185 |
'Path Default: "scheme:/path;attr1=value1?query#fragment"' |
|---|
| 186 |
URIstr = 'scheme:/path;attr1=value1?query#fragment' |
|---|
| 187 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 188 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 189 |
self.verifyURIParts(uri, 'scheme', None, '/path;attr1=value1', 'query', 'fragment') |
|---|
| 190 |
|
|---|
| 191 |
def testNullAuthorityPathAttributesQueryFragment(self): |
|---|
| 192 |
'Path Default: "///path;attr1=value1?query#fragment"' |
|---|
| 193 |
URIstr = '///path;attr1=value1?query#fragment' |
|---|
| 194 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 195 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 196 |
self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 197 |
|
|---|
| 198 |
def testPathAttributesQueryFragment(self): |
|---|
| 199 |
'Path Default: "/path;attr1=value1?query#fragment"' |
|---|
| 200 |
URIstr = '/path;attr1=value1?query#fragment' |
|---|
| 201 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 202 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 203 |
self.verifyURIParts(uri, None, None, '/path;attr1=value1', 'query', 'fragment') |
|---|
| 204 |
|
|---|
| 205 |
def testPathQueryFragment(self): |
|---|
| 206 |
'Path Default: "/path?query#fragment"' |
|---|
| 207 |
URIstr = '/path?query#fragment' |
|---|
| 208 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 209 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 210 |
self.verifyURIParts(uri, None, None, '/path', 'query', 'fragment') |
|---|
| 211 |
|
|---|
| 212 |
def testQueryFragment(self): |
|---|
| 213 |
'Path Default: "?query#fragment"' |
|---|
| 214 |
URIstr = '?query#fragment' |
|---|
| 215 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 216 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 217 |
self.verifyURIParts(uri, None, None, '', 'query', 'fragment') |
|---|
| 218 |
|
|---|
| 219 |
def testSchemeQuery(self): |
|---|
| 220 |
'Path Default: "scheme:?query"' |
|---|
| 221 |
URIstr = 'scheme:?query' |
|---|
| 222 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 223 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 224 |
self.verifyURIParts(uri, 'scheme', None, '', 'query', None) |
|---|
| 225 |
|
|---|
| 226 |
def testQuery(self): |
|---|
| 227 |
'Path Default: "?query"' |
|---|
| 228 |
URIstr = '?query' |
|---|
| 229 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 230 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 231 |
self.verifyURIParts(uri, None, None, '', 'query', None) |
|---|
| 232 |
|
|---|
| 233 |
def testFragment(self): |
|---|
| 234 |
'Path Default: "#fragment"' |
|---|
| 235 |
URIstr = '#fragment' |
|---|
| 236 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 237 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 238 |
self.verifyURIParts(uri, None, None, '', None, 'fragment') |
|---|
| 239 |
|
|---|
| 240 |
def testSchemeFragment(self): |
|---|
| 241 |
'Path Default: "scheme:#fragment"' |
|---|
| 242 |
URIstr = 'scheme:#fragment' |
|---|
| 243 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 244 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 245 |
self.verifyURIParts(uri, 'scheme', None, '', None, 'fragment') |
|---|
| 246 |
|
|---|
| 247 |
def testPathQuery(self): |
|---|
| 248 |
'Path Default: "/path?query"' |
|---|
| 249 |
URIstr = '/path?query' |
|---|
| 250 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 251 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 252 |
self.verifyURIParts(uri, None, None, '/path', 'query', None) |
|---|
| 253 |
|
|---|
| 254 |
def testPathFragment(self): |
|---|
| 255 |
'Path Default: "/path#fragment"' |
|---|
| 256 |
URIstr = '/path#fragment' |
|---|
| 257 |
uri = URIparser.URIPathDefault(URIstr) |
|---|
| 258 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 259 |
self.verifyURIParts(uri, None, None, '/path', None, 'fragment') |
|---|
| 260 |
|
|---|
| 261 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 262 |
|
|---|
| 263 |
class URIAuthorityDefaultTestCase(unittest.TestCase): |
|---|
| 264 |
def verifyURIParts(self, uri, scheme, authority, path, query, fragment): |
|---|
| 265 |
self.failUnlessEqual(uri.scheme, scheme) |
|---|
| 266 |
self.failUnlessEqual(uri.authority, authority) |
|---|
| 267 |
self.failUnlessEqual(uri.path, path) |
|---|
| 268 |
self.failUnlessEqual(uri.query, query) |
|---|
| 269 |
self.failUnlessEqual(uri.fragment, fragment) |
|---|
| 270 |
|
|---|
| 271 |
def testScheme(self): |
|---|
| 272 |
'Authority Default: "scheme:"' |
|---|
| 273 |
URIstr = 'scheme:' |
|---|
| 274 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 275 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 276 |
self.verifyURIParts(uri, 'scheme', '', None, None, None) |
|---|
| 277 |
|
|---|
| 278 |
def testAuthority(self): |
|---|
| 279 |
'Authority Default: "authority"' |
|---|
| 280 |
URIstr = 'authority' |
|---|
| 281 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 282 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 283 |
self.verifyURIParts(uri, None, 'authority', None, None, None) |
|---|
| 284 |
|
|---|
| 285 |
def testPath(self): |
|---|
| 286 |
'Authority Default: "/path"' |
|---|
| 287 |
URIstr = '/path' |
|---|
| 288 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 289 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 290 |
self.verifyURIParts(uri, None, '', '/path', None, None) |
|---|
| 291 |
|
|---|
| 292 |
def testSchemeAuthority(self): |
|---|
| 293 |
'Authority Default: "scheme:authority"' |
|---|
| 294 |
URIstr = 'scheme:authority' |
|---|
| 295 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 296 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 297 |
self.verifyURIParts(uri, 'scheme', 'authority', None, None, None) |
|---|
| 298 |
|
|---|
| 299 |
def testSchemePath(self): |
|---|
| 300 |
'Authority Default: "scheme:/path"' |
|---|
| 301 |
URIstr = 'scheme:/path' |
|---|
| 302 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 303 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 304 |
self.verifyURIParts(uri, 'scheme', '', '/path', None, None) |
|---|
| 305 |
|
|---|
| 306 |
def testNetworkAuthority(self): |
|---|
| 307 |
'Authority Default: "//authority"' |
|---|
| 308 |
URIstr = '//authority' |
|---|
| 309 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 310 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 311 |
self.verifyURIParts(uri, None, 'authority', None, None, None) |
|---|
| 312 |
|
|---|
| 313 |
def testSchemeNetworkAuthority(self): |
|---|
| 314 |
'Authority Default: "scheme://authority"' |
|---|
| 315 |
URIstr = 'scheme://authority' |
|---|
| 316 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 317 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 318 |
self.verifyURIParts(uri, 'scheme', 'authority', None, None, None) |
|---|
| 319 |
|
|---|
| 320 |
def testAuthorityPath(self): |
|---|
| 321 |
'Authority Default: "authority/path"' |
|---|
| 322 |
URIstr = 'authority/path' |
|---|
| 323 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 324 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 325 |
self.verifyURIParts(uri, None, 'authority', '/path', None, None) |
|---|
| 326 |
|
|---|
| 327 |
def testNetworkAuthorityPath(self): |
|---|
| 328 |
'Authority Default: "//authority/path"' |
|---|
| 329 |
URIstr = '//authority/path' |
|---|
| 330 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 331 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 332 |
self.verifyURIParts(uri, None, 'authority', '/path', None, None) |
|---|
| 333 |
|
|---|
| 334 |
def testSchemeAuthorityPath(self): |
|---|
| 335 |
'Authority Default: "scheme:authority/path"' |
|---|
| 336 |
URIstr = 'scheme:authority/path' |
|---|
| 337 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 338 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 339 |
self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) |
|---|
| 340 |
|
|---|
| 341 |
def testSchemeNetworkAuthorityPath(self): |
|---|
| 342 |
'Authority Default: "scheme://authority/path"' |
|---|
| 343 |
URIstr = 'scheme://authority/path' |
|---|
| 344 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 345 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 346 |
self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) |
|---|
| 347 |
|
|---|
| 348 |
def testNetworkUserAuthorityPath(self): |
|---|
| 349 |
'Authority Default: "//user@authority/path"' |
|---|
| 350 |
URIstr = '//user@authority/path' |
|---|
| 351 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 352 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 353 |
self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) |
|---|
| 354 |
|
|---|
| 355 |
def testUserAuthorityPath(self): |
|---|
| 356 |
'Authority Default: "user@authority/path"' |
|---|
| 357 |
URIstr = 'user@authority/path' |
|---|
| 358 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 359 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 360 |
self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) |
|---|
| 361 |
|
|---|
| 362 |
def testSchemeUserAuthorityPath(self): |
|---|
| 363 |
'Authority Default: "scheme:user@authority/path"' |
|---|
| 364 |
URIstr = 'scheme:user@authority/path' |
|---|
| 365 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 366 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 367 |
self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) |
|---|
| 368 |
|
|---|
| 369 |
def testSchemeNetworkUserAuthorityPath(self): |
|---|
| 370 |
'Authority Default: "scheme://user@authority/path"' |
|---|
| 371 |
URIstr = 'scheme://user@authority/path' |
|---|
| 372 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 373 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 374 |
self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) |
|---|
| 375 |
|
|---|
| 376 |
def testSchemeNetworkUserAuthorityHostPath(self): |
|---|
| 377 |
'Authority Default: "scheme://user@authority:4242/path"' |
|---|
| 378 |
URIstr = 'scheme://user@authority:4242/path' |
|---|
| 379 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 380 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 381 |
self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) |
|---|
| 382 |
|
|---|
| 383 |
def testSchemeUserAuthorityHostPath(self): |
|---|
| 384 |
'Authority Default: "scheme:user@authority:4242/path"' |
|---|
| 385 |
URIstr = 'scheme:user@authority:4242/path' |
|---|
| 386 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 387 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 388 |
self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) |
|---|
| 389 |
|
|---|
| 390 |
def testMailto(self): |
|---|
| 391 |
'Authority Default: "mailto:user@host"' |
|---|
| 392 |
URIstr = 'mailto:user@host' |
|---|
| 393 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 394 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 395 |
self.verifyURIParts(uri, 'mailto', 'user@host', None, None, None) |
|---|
| 396 |
|
|---|
| 397 |
def testNetworkUserPasswdAuthority(self): |
|---|
| 398 |
'Authority Default: "//user:passwd@authority"' |
|---|
| 399 |
URIstr = '//user:passwd@authority' |
|---|
| 400 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 401 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 402 |
self.verifyURIParts(uri, None, 'user:passwd@authority', None, None, None) |
|---|
| 403 |
|
|---|
| 404 |
def testNetworkUserPasswdAuthorityHostPath(self): |
|---|
| 405 |
'Authority Default: "//user:passwd@authority:4242/path"' |
|---|
| 406 |
URIstr = '//user:passwd@authority:4242/path' |
|---|
| 407 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 408 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 409 |
self.verifyURIParts(uri, None, 'user:passwd@authority:4242', '/path', None, None) |
|---|
| 410 |
|
|---|
| 411 |
def testSchemeNetworkUserPasswdAuthorityHostPath(self): |
|---|
| 412 |
'Authority Default: "scheme://user:passwd@authority:4242/path"' |
|---|
| 413 |
URIstr = 'scheme://user:passwd@authority:4242/path' |
|---|
| 414 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 415 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 416 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) |
|---|
| 417 |
|
|---|
| 418 |
def testSchemeUserPasswdAuthorityHostPath(self): |
|---|
| 419 |
'Authority Default: "scheme:user:passwd@authority:4242/path"' |
|---|
| 420 |
URIstr = 'scheme:user:passwd@authority:4242/path' |
|---|
| 421 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 422 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 423 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) |
|---|
| 424 |
|
|---|
| 425 |
def testSchemeNetworkUserPasswdAuthorityHostPathAttributes(self): |
|---|
| 426 |
'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1"' |
|---|
| 427 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1' |
|---|
| 428 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 429 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 430 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) |
|---|
| 431 |
|
|---|
| 432 |
def testSchemeUserPasswdAuthorityHostPathAttributes(self): |
|---|
| 433 |
'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1"' |
|---|
| 434 |
URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1' |
|---|
| 435 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 436 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 437 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) |
|---|
| 438 |
|
|---|
| 439 |
def testSchemeNetworkUserPasswdAuthorityHostPathAttributesQuery(self): |
|---|
| 440 |
'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query"' |
|---|
| 441 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query' |
|---|
| 442 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 443 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 444 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) |
|---|
| 445 |
|
|---|
| 446 |
def testSchemeUserPasswdAuthorityHostPathAttributesQuery(self): |
|---|
| 447 |
'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1?query"' |
|---|
| 448 |
URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1?query' |
|---|
| 449 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 450 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 451 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) |
|---|
| 452 |
|
|---|
| 453 |
def testSchemeNetworkUserPasswdAuthorityHostPathAttributesQueryFragment(self): |
|---|
| 454 |
'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment"' |
|---|
| 455 |
URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment' |
|---|
| 456 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 457 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 458 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 459 |
|
|---|
| 460 |
def testSchemeUserPasswdAuthorityHostPathAttributesQueryFragment(self): |
|---|
| 461 |
'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1?query#fragment"' |
|---|
| 462 |
URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1?query#fragment' |
|---|
| 463 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 464 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 465 |
self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 466 |
|
|---|
| 467 |
def testSchemeNetworkNullAuthorityPathAttributesQueryFragment(self): |
|---|
| 468 |
'Authority Default: "scheme:///path;attr1=value1?query#fragment"' |
|---|
| 469 |
URIstr = 'scheme:///path;attr1=value1?query#fragment' |
|---|
| 470 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 471 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 472 |
self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 473 |
|
|---|
| 474 |
def testSchemePathAttributesQueryFragment(self): |
|---|
| 475 |
'Authority Default: "scheme:/path;attr1=value1?query#fragment"' |
|---|
| 476 |
URIstr = 'scheme:/path;attr1=value1?query#fragment' |
|---|
| 477 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 478 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 479 |
self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 480 |
|
|---|
| 481 |
def testNetworkNullAuthorityPathAttributesQueryFragment(self): |
|---|
| 482 |
'Authority Default: "///path;attr1=value1?query#fragment"' |
|---|
| 483 |
URIstr = '///path;attr1=value1?query#fragment' |
|---|
| 484 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 485 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 486 |
self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 487 |
|
|---|
| 488 |
def testPathAttributesQueryFragment(self): |
|---|
| 489 |
'Authority Default: "/path;attr1=value1?query#fragment"' |
|---|
| 490 |
URIstr = '/path;attr1=value1?query#fragment' |
|---|
| 491 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 492 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 493 |
self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') |
|---|
| 494 |
|
|---|
| 495 |
def testPathQueryFragment(self): |
|---|
| 496 |
'Authority Default: "/path?query#fragment"' |
|---|
| 497 |
URIstr = '/path?query#fragment' |
|---|
| 498 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 499 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 500 |
self.verifyURIParts(uri, None, '', '/path', 'query', 'fragment') |
|---|
| 501 |
|
|---|
| 502 |
def testQueryFragment(self): |
|---|
| 503 |
'Authority Default: "?query#fragment"' |
|---|
| 504 |
URIstr = '?query#fragment' |
|---|
| 505 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 506 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 507 |
self.verifyURIParts(uri, None, '', None, 'query', 'fragment') |
|---|
| 508 |
|
|---|
| 509 |
def testSchemeQuery(self): |
|---|
| 510 |
'Authority Default: "scheme:?query"' |
|---|
| 511 |
URIstr = 'scheme:?query' |
|---|
| 512 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 513 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 514 |
self.verifyURIParts(uri, 'scheme', '', None, 'query', None) |
|---|
| 515 |
|
|---|
| 516 |
def testQuery(self): |
|---|
| 517 |
'Authority Default: "?query"' |
|---|
| 518 |
URIstr = '?query' |
|---|
| 519 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 520 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 521 |
self.verifyURIParts(uri, None, '', None, 'query', None) |
|---|
| 522 |
|
|---|
| 523 |
def testFragment(self): |
|---|
| 524 |
'Authority Default: "#fragment"' |
|---|
| 525 |
URIstr = '#fragment' |
|---|
| 526 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 527 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 528 |
self.verifyURIParts(uri, None, '', None, None, 'fragment') |
|---|
| 529 |
|
|---|
| 530 |
def testSchemeFragment(self): |
|---|
| 531 |
'Authority Default: "scheme:#fragment"' |
|---|
| 532 |
URIstr = 'scheme:#fragment' |
|---|
| 533 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 534 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 535 |
self.verifyURIParts(uri, 'scheme', '', None, None, 'fragment') |
|---|
| 536 |
|
|---|
| 537 |
def testPathQuery(self): |
|---|
| 538 |
'Authority Default: "/path?query"' |
|---|
| 539 |
URIstr = '/path?query' |
|---|
| 540 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 541 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 542 |
self.verifyURIParts(uri, None, '', '/path', 'query', None) |
|---|
| 543 |
|
|---|
| 544 |
def testPathFragment(self): |
|---|
| 545 |
'Authority Default: "/path#fragment"' |
|---|
| 546 |
URIstr = '/path#fragment' |
|---|
| 547 |
uri = URIparser.URIAuthorityDefault(URIstr) |
|---|
| 548 |
self.failUnlessEqual(uri.uri, URIstr) |
|---|
| 549 |
self.verifyURIParts(uri, None, '', '/path', None, 'fragment') |
|---|
| 550 |
|
|---|
| 551 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 552 |
#~ Unittest Main |
|---|
| 553 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 554 |
|
|---|
| 555 |
if __name__=='__main__': |
|---|
| 556 |
unittest.main() |
|---|
| 557 |
|
|---|