bundled/cherrypy/cherrypy/test/test_httplib.py @ 36b37712c670
webpy-sucks
Get a bare Cherrypy server up and running.
author |
Steve Losh <steve@stevelosh.com> |
date |
Tue, 02 Mar 2010 20:23:36 -0500 |
parents |
4e1fb853d9d2 |
children |
(none) |
"""Tests for cherrypy/lib/httputil.py."""
from cherrypy.test import test
test.prefer_parent_path()
import unittest
from cherrypy.lib import httputil
class UtilityTests(unittest.TestCase):
def test_urljoin(self):
# Test all slash+atom combinations for SCRIPT_NAME and PATH_INFO
self.assertEqual(httputil.urljoin("/sn/", "/pi/"), "/sn/pi/")
self.assertEqual(httputil.urljoin("/sn/", "/pi"), "/sn/pi")
self.assertEqual(httputil.urljoin("/sn/", "/"), "/sn/")
self.assertEqual(httputil.urljoin("/sn/", ""), "/sn/")
self.assertEqual(httputil.urljoin("/sn", "/pi/"), "/sn/pi/")
self.assertEqual(httputil.urljoin("/sn", "/pi"), "/sn/pi")
self.assertEqual(httputil.urljoin("/sn", "/"), "/sn/")
self.assertEqual(httputil.urljoin("/sn", ""), "/sn")
self.assertEqual(httputil.urljoin("/", "/pi/"), "/pi/")
self.assertEqual(httputil.urljoin("/", "/pi"), "/pi")
self.assertEqual(httputil.urljoin("/", "/"), "/")
self.assertEqual(httputil.urljoin("/", ""), "/")
self.assertEqual(httputil.urljoin("", "/pi/"), "/pi/")
self.assertEqual(httputil.urljoin("", "/pi"), "/pi")
self.assertEqual(httputil.urljoin("", "/"), "/")
self.assertEqual(httputil.urljoin("", ""), "/")
if __name__ == '__main__':
unittest.main()