

def test_media_urls(self):
    "\n        Tests that URLs that look like absolute file paths after the\n        settings.ADMIN_MEDIA_PREFIX don't turn into absolute file paths.\n        "
    data = (('/media/css/base.css', ('css', 'base.css')),)
    bad_data = ()
    if (os.sep == '/'):
        data += (('/media/\\css/base.css', ('\\css', 'base.css')),)
        bad_data += ('/media//css/base.css', '/media////css/base.css', '/media/../css/base.css')
    elif (os.sep == '\\'):
        bad_data += ('/media/C:\\css/base.css', '/media//\\css/base.css', '/media/\\css/base.css', '/media/\\\\css/base.css')
    for (url, path_tuple) in data:
        try:
            output = self.handler.file_path(url)
        except ValueError:
            self.fail(("Got a ValueError exception, but wasn't expecting one. URL was: %s" % url))
        rel_path = os.path.join(*path_tuple)
        desired = os.path.normcase(os.path.join(self.admin_media_file_path, rel_path))
        self.assertEqual(output, desired, ('Got: %s, Expected: %s, URL was: %s' % (output, desired, url)))
    for url in bad_data:
        try:
            output = self.handler.file_path(url)
        except ValueError:
            continue
        self.fail(('URL: %s should have caused a ValueError exception.' % url))

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/tests/regressiontests/servers/tests.py AdminMediaHandlerTests.test_media_urls/original