From: richard Date: Thu, 14 Feb 2002 23:38:12 +0000 (+0000) Subject: Fixed the unit tests for the mailgw re: the x-roundup-name header. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9d5fc0aa9325514d396efc92d52dab31bb373ad1;p=roundup.git Fixed the unit tests for the mailgw re: the x-roundup-name header. Also made the test runner more user-friendly: ./run_tests - detect all tests in test/test_.py and run them ./run_tests - run only test/test_.py eg ./run_tests mailgw - run the mailgw test from test/test_mailgw.py git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@625 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/run_tests b/run_tests index 0bfc161..032b7c9 100755 --- a/run_tests +++ b/run_tests @@ -9,13 +9,20 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: run_tests,v 1.3 2002-01-23 20:09:41 jhermann Exp $ +# $Id: run_tests,v 1.4 2002-02-14 23:38:12 richard Exp $ -import test -test.go() +from test import go +import sys +if len(sys.argv) > 1: + go(sys.argv[1:]) +else: + go() # # $Log: not supported by cvs2svn $ +# Revision 1.3 2002/01/23 20:09:41 jhermann +# Proper fix for failing test +# # Revision 1.2 2002/01/23 11:08:52 grubert # . run_tests testReldate_date failed if LANG is 'german' # diff --git a/test/__init__.py b/test/__init__.py index 8b55c40..749ba67 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -15,33 +15,33 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: __init__.py,v 1.15 2002-01-22 00:12:20 richard Exp $ +# $Id: __init__.py,v 1.16 2002-02-14 23:38:12 richard Exp $ -import unittest -import os, tempfile +import os, tempfile, unittest, shutil os.environ['SENDMAILDEBUG'] = tempfile.mktemp() -import test_dates, test_schema, test_db, test_multipart, test_mailsplit -import test_init, test_token, test_mailgw, test_htmltemplate +# figure all the modules available +dir = os.path.split(__file__)[0] +test_mods = {} +for file in os.listdir(dir): + if file.startswith('test_') and file.endswith('.py'): + name = file[5:-3] + test_mods[name] = __import__(file[:-3], globals(), locals(), []) +all_tests = test_mods.keys() -def go(): - suite = unittest.TestSuite(( - test_dates.suite(), - test_schema.suite(), - test_db.suite(), - test_init.suite(), - test_multipart.suite(), - test_mailsplit.suite(), - test_mailgw.suite(), - test_token.suite(), - test_htmltemplate.suite(), - )) +def go(tests=all_tests): + l = [] + for name in tests: + l.append(test_mods[name].suite()) + suite = unittest.TestSuite(l) runner = unittest.TextTestRunner() - result = runner.run(suite) - return result.wasSuccessful() + runner.run(suite) # # $Log: not supported by cvs2svn $ +# Revision 1.15 2002/01/22 00:12:20 richard +# oops +# # Revision 1.14 2002/01/22 00:12:06 richard # Wrote more unit tests for htmltemplate, and while I was at it, I polished # off the implementation of some of the functions so they behave sanely. diff --git a/test/test_mailgw.py b/test/test_mailgw.py index e1a7508..58dda70 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.10 2002-02-12 08:08:55 grubert Exp $ +# $Id: test_mailgw.py,v 1.11 2002-02-14 23:38:12 richard Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys @@ -86,6 +86,7 @@ From: Chef Reply-To: Roundup issue tracker MIME-Version: 1.0 Message-Id: +X-Roundup-Name: Roundup issue tracker New submission from Chef : @@ -113,7 +114,7 @@ ___________________________________________________ # the ip address of the test machine. # BUG should test some binary attamchent too. - + def testFollowup(self): self.testNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; @@ -140,6 +141,7 @@ Reply-To: Roundup issue tracker MIME-Version: 1.0 Message-Id: In-Reply-To: +X-Roundup-Name: Roundup issue tracker richard added the comment: @@ -182,6 +184,7 @@ Reply-To: Roundup issue tracker MIME-Version: 1.0 Message-Id: In-Reply-To: +X-Roundup-Name: Roundup issue tracker mary added the comment: @@ -227,6 +230,7 @@ Reply-To: Roundup issue tracker MIME-Version: 1.0 Message-Id: In-Reply-To: +X-Roundup-Name: Roundup issue tracker mary added the comment: @@ -279,6 +283,7 @@ Reply-To: Roundup issue tracker MIME-Version: 1.0 Message-Id: In-Reply-To: +X-Roundup-Name: Roundup issue tracker mary added the comment: @@ -305,6 +310,9 @@ def suite(): # # $Log: not supported by cvs2svn $ +# Revision 1.10 2002/02/12 08:08:55 grubert +# . Clean up mail handling, multipart handling. +# # Revision 1.9 2002/02/05 14:15:29 grubert # . respect encodings in non multipart messages. #