annotate test/test_textfmt.py @ 5034:4ad465b09cbe

Update test/test_actions.py to work with py.test The test_actions tests use a FieldStorage object to mock form submissions. FieldStorage would usually use the 'QUERY_STRING' environment variable to populate the initial list of MiniFieldStorage values stored within the FieldStorage object, but because there is no 'QUERY_STRING' environment variable when running the test from the commandline it tries to parse sys.argv instead. If any py.test options are used (ie. '--tb=short') then they may end up in the MiniFieldStorage list causing some tests to fail because they were not expecting the extra MiniFieldStorage values. To fix this we explicitly pass an dict with an empty 'QUERY_STRING' value as the FieldStorage environ argument to ensure that the initial MiniFieldStorage list is empty.
author John Kristensen <john@jerrykan.com>
date Thu, 20 Aug 2015 16:30:50 +1000
parents f35ece8f8ff7
children 364c54991861
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3644
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1 import unittest
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3 from roundup.support import wrap
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5 class WrapTestCase(unittest.TestCase):
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6 def testWrap(self):
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 lorem = '''Lorem ipsum dolor sit amet, consectetuer adipiscing elit.'''
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8 wrapped = '''Lorem ipsum dolor
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 sit amet,
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 consectetuer
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11 adipiscing elit.'''
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 self.assertEquals(wrap(lorem, 20), wrapped)
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 def test_suite():
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 suite = unittest.TestSuite()
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 suite.addTest(unittest.makeSuite(WrapTestCase))
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17 return suite

Roundup Issue Tracker: http://roundup-tracker.org/