Mercurial > p > roundup > code
comparison test/test_cgi.py @ 1873:f63aa57386b0
Backend improvements.
- using Zope3's test runner now, allowing GC checks, nicer controls and
coverage analysis
- all RDMBS backends now have indexes on several columns
- added testing of schema mutation, fixed rdbms backends handling of a
couple of cases
- !BETA! added postgresql backend, needs work !BETA!
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sat, 25 Oct 2003 22:53:26 +0000 |
| parents | e24cebaaa7e8 |
| children | 1782fe36e7b8 |
comparison
equal
deleted
inserted
replaced
| 1872:c085b4f4f0c0 | 1873:f63aa57386b0 |
|---|---|
| 6 # | 6 # |
| 7 # This module is distributed in the hope that it will be useful, | 7 # This module is distributed in the hope that it will be useful, |
| 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 10 # | 10 # |
| 11 # $Id: test_cgi.py,v 1.20 2003-09-24 14:54:23 jlgijsbers Exp $ | 11 # $Id: test_cgi.py,v 1.21 2003-10-25 22:53:26 richard Exp $ |
| 12 | 12 |
| 13 import unittest, os, shutil, errno, sys, difflib, cgi, re | 13 import unittest, os, shutil, errno, sys, difflib, cgi, re |
| 14 | 14 |
| 15 from roundup.cgi import client | 15 from roundup.cgi import client |
| 16 from roundup.cgi.client import FormError | 16 from roundup.cgi.client import FormError |
| 66 try: | 66 try: |
| 67 shutil.rmtree(self.dirname) | 67 shutil.rmtree(self.dirname) |
| 68 except OSError, error: | 68 except OSError, error: |
| 69 if error.errno not in (errno.ENOENT, errno.ESRCH): raise | 69 if error.errno not in (errno.ENOENT, errno.ESRCH): raise |
| 70 # create the instance | 70 # create the instance |
| 71 shutil.copytree('_empty_instance', self.dirname) | 71 init.install(self.dirname, 'templates/classic') |
| 72 init.write_select_db(self.dirname, 'anydbm') | |
| 73 init.initialise(self.dirname, 'sekrit') | |
| 72 | 74 |
| 73 # check we can load the package | 75 # check we can load the package |
| 74 self.instance = instance.open(self.dirname) | 76 self.instance = instance.open(self.dirname) |
| 75 # and open the database | 77 # and open the database |
| 76 self.db = self.instance.open('admin') | 78 self.db = self.instance.open('admin') |
| 528 self.assertEqual(self.parseForm({':file': file}, 'issue'), | 530 self.assertEqual(self.parseForm({':file': file}, 'issue'), |
| 529 ({('issue', None): {}, ('file', '-1'): {'content': 'foo', | 531 ({('issue', None): {}, ('file', '-1'): {'content': 'foo', |
| 530 'name': 'foo.txt', 'type': 'text/plain'}}, | 532 'name': 'foo.txt', 'type': 'text/plain'}}, |
| 531 [('issue', None, 'files', [('file', '-1')])])) | 533 [('issue', None, 'files', [('file', '-1')])])) |
| 532 | 534 |
| 533 def suite(): | 535 def test_suite(): |
| 534 l = [ | 536 suite = unittest.TestSuite() |
| 535 unittest.makeSuite(FormTestCase), | 537 suite.addTest(unittest.makeSuite(FormTestCase)) |
| 536 unittest.makeSuite(MessageTestCase), | 538 suite.addTest(unittest.makeSuite(MessageTestCase)) |
| 537 ] | 539 return suite |
| 538 return unittest.TestSuite(l) | 540 |
| 539 | 541 if __name__ == '__main__': |
| 540 def run(): | |
| 541 runner = unittest.TextTestRunner() | 542 runner = unittest.TextTestRunner() |
| 542 unittest.main(testRunner=runner) | 543 unittest.main(testRunner=runner) |
| 543 | 544 |
| 544 if __name__ == '__main__': | |
| 545 run() | |
| 546 | |
| 547 # vim: set filetype=python ts=4 sw=4 et si | 545 # vim: set filetype=python ts=4 sw=4 et si |
