[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/tests -
test_loader.py:1.8
Fred L. Drake, Jr.
fred at zope.com
Thu May 13 11:06:35 EDT 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools/tests
In directory cvs.zope.org:/tmp/cvs-serv20088/tests
Modified Files:
test_loader.py
Log Message:
put knowledge about how to compute a "base" URL to a helper function
=== Packages/zpkgtools/zpkgtools/tests/test_loader.py 1.7 => 1.8 ===
--- Packages/zpkgtools/zpkgtools/tests/test_loader.py:1.7 Mon May 10 14:48:49 2004
+++ Packages/zpkgtools/zpkgtools/tests/test_loader.py Thu May 13 11:06:34 2004
@@ -253,9 +253,67 @@
self.assertEqual(firstline, expected)
+class UrlFunctionTestCase(unittest.TestCase):
+
+ TYPE = "svn"
+ HOSTPART = "svn.example.org"
+
+ def mkurl(self, path):
+ return "%s://%s%s" % (self.TYPE, self.HOSTPART, path)
+
+ def test_baseUrl(self):
+ eq = self.assertEqual
+ eq(loader.baseUrl("file:///tmp/foo/bar/splat.py"),
+ "file:///tmp/foo/bar/")
+ eq(loader.baseUrl("file://localhost/tmp/foo/bar/splat.py"),
+ "file://localhost/tmp/foo/bar/")
+ eq(loader.baseUrl("cvs://cvs.example.org/cvsroot:path/file.txt:TAG"),
+ "cvs://cvs.example.org/cvsroot:path/:TAG")
+
+ # tagless Subversion URLs
+ mkurl = self.mkurl
+ eq(loader.baseUrl(mkurl("/repos/path/file.txt")),
+ mkurl("/repos/path/"))
+ eq(loader.baseUrl(mkurl("/repos/branches/foo/path/file.txt")),
+ mkurl("/repos/branches/foo/path/"))
+ # taggable Subversion URLs
+ eq(loader.baseUrl(mkurl("/repos/trunk/path/file.txt")),
+ mkurl("/repos/trunk/path/"))
+ eq(loader.baseUrl(mkurl("/repos/tags/foo/path/file.txt")),
+ mkurl("/repos/tags/foo/path/"))
+
+
+class SvnSshUrlFunctionTestCase(UrlFunctionTestCase):
+
+ TYPE = "svn+ssh"
+
+
+class SvnSpecialUrlFunctionTestCase(UrlFunctionTestCase):
+
+ TYPE = "svn+other"
+
+
+class SvnFileUrlFunctionTestCase(UrlFunctionTestCase,
+ test_svnloader.SubversionLocalRepositoryBase):
+
+ TYPE = "file"
+ HOSTPART = ""
+
+
+class SvnFileLocalhostUrlFunctionTestCase(SvnFileUrlFunctionTestCase):
+
+ HOSTPART = "localhost"
+
+
+
def test_suite():
suite = unittest.makeSuite(FileProxyTestCase)
suite.addTest(unittest.makeSuite(LoaderTestCase))
+ suite.addTest(unittest.makeSuite(UrlFunctionTestCase))
+ suite.addTest(unittest.makeSuite(SvnSshUrlFunctionTestCase))
+ suite.addTest(unittest.makeSuite(SvnSpecialUrlFunctionTestCase))
+ suite.addTest(unittest.makeSuite(SvnFileUrlFunctionTestCase))
+ suite.addTest(unittest.makeSuite(SvnFileLocalhostUrlFunctionTestCase))
return suite
if __name__ == "__main__":
More information about the Zope-CVS
mailing list