# HG changeset patch # User aronacher # Date 1196359717 0 # Node ID f8c99285e392f6ac142d66e4cb95852f5d81f88e # Parent 11b2fc530c94e4a582447eda17f6abfcda4484bf added first (and pretty useless) test for the restricted branch diff --git a/genshi/tests/restrictions.py b/genshi/tests/restrictions.py new file mode 100644 --- /dev/null +++ b/genshi/tests/restrictions.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2006 Edgewall Software +# All rights reserved. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://genshi.edgewall.org/wiki/License. +# +# This software consists of voluntary contributions made by many +# individuals. For the exact contribution history, see the revision +# history and logs, available at http://genshi.edgewall.org/log/. + +import unittest + +from genshi.template import MarkupTemplate + + +exploit_template = MarkupTemplate(u'''\ + +
+

${(42).__class__.__base__}

+ +''', lookup='lenient', restricted=True) + + +class RestrictionsTestCase(unittest.TestCase): + + def test_various_exploits(self): + self.assertEqual(exploit_template.generate().render('html'), + '\n
\n

\n') + +def suite(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(RestrictionsTestCase, 'test')) + return suite + + +if __name__ == '__main__': + unittest.main(defaultTest='suite')