Example #1
0
 def testStoresFragment(self):
     """WalkerBase stores the fragment portion of a supporting URL."""
     WalkerBase.FRAGMENTS = True
     try:
         w = WalkerBase("http://localhost/#foo")
         self.assertEqual(w.fragment, "foo")
     finally:
         WalkerBase.FRAGMENTS = False
Example #2
0
 def testNoUsername(self):
     """WalkerBase stores None when there is no username."""
     w = WalkerBase("ftp://localhost/")
     self.assertEqual(w.user, None)
Example #3
0
 def testUnescapesHost(self):
     """WalkerBase unescapes the host portion."""
     w = WalkerBase("ftp://local%40host/")
     self.assertEqual(w.host, "local@host")
Example #4
0
 def testNoScheme(self):
     """WalkerBase works when given a URL with no scheme."""
     w = WalkerBase("/")
     self.assertEqual(w.host, "")
Example #5
0
 def testSetsHost(self):
     """WalkerBase sets the host property."""
     w = WalkerBase("ftp://localhost/")
     self.assertEqual(w.host, "localhost")
Example #6
0
 def testSetsScheme(self):
     """WalkerBase sets the scheme property."""
     w = WalkerBase("ftp://localhost/")
     self.assertEqual(w.scheme, "ftp")
Example #7
0
 def testUnescapesPassword(self):
     """WalkerBase unescapes the password portion."""
     w = WalkerBase("ftp://*****:*****@localhost/")
     self.assertEqual(w.user, "scott")
     self.assertEqual(w.passwd, "wibble wobble")
     self.assertEqual(w.host, "localhost")
Example #8
0
 def testNoPassword(self):
     """WalkerBase stores None when there is no password."""
     w = WalkerBase("ftp://scott@localhost/")
     self.assertEqual(w.passwd, None)
Example #9
0
 def testCreatesDefaultLogger(self):
     """WalkerBase creates a default logger."""
     w = WalkerBase("/")
     self.assertTrue(isinstance(w.log, logging.Logger))
Example #10
0
 def testUnescapesPath(self):
     """WalkerBase leaves the path escaped."""
     w = WalkerBase("ftp://localhost/some%20thing/")
     self.assertEqual(w.path, "/some%20thing/")
Example #11
0
 def testStoresQuery(self):
     """WalkerBase stores the query portion of a supporting URL."""
     w = WalkerBase("http://localhost/?foo")
     self.assertEqual(w.query, "foo")
Example #12
0
 def testAddsSlashToPath(self):
     """WalkerBase adds a trailing slash to path if ommitted."""
     w = WalkerBase("ftp://localhost/path/to/something")
     self.assertEqual(w.path, "/path/to/something/")
Example #13
0
 def testPathInUrl(self):
     """WalkerBase stores the path portion of a complete URL."""
     w = WalkerBase("ftp://localhost/path/to/something/")
     self.assertEqual(w.path, "/path/to/something/")
Example #14
0
 def testPathOnly(self):
     """WalkerBase stores the path if that's all there is."""
     w = WalkerBase("/path/to/something/")
     self.assertEqual(w.path, "/path/to/something/")
Example #15
0
 def testUsername(self):
     """WalkerBase splits out the username from the host portion."""
     w = WalkerBase("ftp://scott@localhost/")
     self.assertEqual(w.user, "scott")
     self.assertEqual(w.host, "localhost")
Example #16
0
 def testCreatesChildLogger(self):
     """WalkerBase creates a child logger if given a parent."""
     parent = logging.getLogger("foo")
     w = WalkerBase("/", log_parent=parent)
     self.assertEqual(w.log.parent, parent)
Example #17
0
 def testUnescapesUsername(self):
     """WalkerBase unescapes the username portion."""
     w = WalkerBase("ftp://scott%3awibble@localhost/")
     self.assertEqual(w.user, "scott:wibble")
     self.assertEqual(w.host, "localhost")
Example #18
0
 def testSetsBase(self):
     """WalkerBase sets the base property."""
     w = WalkerBase("ftp://localhost/")
     self.assertEqual(w.base, "ftp://localhost/")
Example #19
0
 def testPassword(self):
     """WalkerBase splits out the password from the username."""
     w = WalkerBase("ftp://*****:*****@localhost/")
     self.assertEqual(w.user, "scott")
     self.assertEqual(w.passwd, "wibble")
     self.assertEqual(w.host, "localhost")
 def testCreatesDefaultLogger(self):
     """WalkerBase creates a default logger."""
     from logging import Logger
     w = WalkerBase("/")
     self.failUnless(isinstance(w.log, Logger))