summaryrefslogtreecommitdiffstats
path: root/patchwork/tests
diff options
context:
space:
mode:
Diffstat (limited to 'patchwork/tests')
-rw-r--r--patchwork/tests/__init__.py35
-rw-r--r--patchwork/tests/test_patchparser.py40
2 files changed, 39 insertions, 36 deletions
diff --git a/patchwork/tests/__init__.py b/patchwork/tests/__init__.py
index 662386a..e69de29 100644
--- a/patchwork/tests/__init__.py
+++ b/patchwork/tests/__init__.py
@@ -1,35 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# This file is part of the Patchwork package.
-#
-# Patchwork is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Patchwork is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Patchwork; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-from patchwork.tests.test_patchparser import *
-from patchwork.tests.test_tags import *
-from patchwork.tests.test_encodings import *
-from patchwork.tests.test_bundles import *
-from patchwork.tests.test_mboxviews import *
-from patchwork.tests.test_updates import *
-from patchwork.tests.test_filters import *
-from patchwork.tests.test_confirm import *
-from patchwork.tests.test_registration import *
-from patchwork.tests.test_user import *
-from patchwork.tests.test_mail_settings import *
-from patchwork.tests.test_notifications import *
-from patchwork.tests.test_list import *
-from patchwork.tests.test_person import *
-from patchwork.tests.test_expiry import *
-from patchwork.tests.test_xmlrpc import *
diff --git a/patchwork/tests/test_patchparser.py b/patchwork/tests/test_patchparser.py
index 5eefeb5..da2b07a 100644
--- a/patchwork/tests/test_patchparser.py
+++ b/patchwork/tests/test_patchparser.py
@@ -37,7 +37,7 @@ class PatchTest(TestCase):
project = defaults.project
from patchwork.bin.parsemail import find_content, find_author, find_project, \
- parse_mail
+ parse_mail, split_prefixes, clean_subject
class InlinePatchTest(PatchTest):
patch_filename = '0001-add-line.patch'
@@ -579,3 +579,41 @@ class ParseInitialTagsTest(PatchTest):
tag__name='Reviewed-by').count, 1)
self.assertEquals(patch.patchtag_set.get(
tag__name='Tested-by').count, 1)
+
+class PrefixTest(TestCase):
+
+ def testSplitPrefixes(self):
+ self.assertEquals(split_prefixes('PATCH'), ['PATCH'])
+ self.assertEquals(split_prefixes('PATCH,RFC'), ['PATCH', 'RFC'])
+ self.assertEquals(split_prefixes(''), [])
+ self.assertEquals(split_prefixes('PATCH,'), ['PATCH'])
+ self.assertEquals(split_prefixes('PATCH '), ['PATCH'])
+ self.assertEquals(split_prefixes('PATCH,RFC'), ['PATCH', 'RFC'])
+ self.assertEquals(split_prefixes('PATCH 1/2'), ['PATCH', '1/2'])
+
+class SubjectTest(TestCase):
+
+ def testCleanSubject(self):
+ self.assertEquals(clean_subject('meep'), 'meep')
+ self.assertEquals(clean_subject('Re: meep'), 'meep')
+ self.assertEquals(clean_subject('[PATCH] meep'), 'meep')
+ self.assertEquals(clean_subject('[PATCH] meep \n meep'), 'meep meep')
+ self.assertEquals(clean_subject('[PATCH RFC] meep'), '[RFC] meep')
+ self.assertEquals(clean_subject('[PATCH,RFC] meep'), '[RFC] meep')
+ self.assertEquals(clean_subject('[PATCH,1/2] meep'), '[1/2] meep')
+ self.assertEquals(clean_subject('[PATCH RFC 1/2] meep'),
+ '[RFC,1/2] meep')
+ self.assertEquals(clean_subject('[PATCH] [RFC] meep'),
+ '[RFC] meep')
+ self.assertEquals(clean_subject('[PATCH] [RFC,1/2] meep'),
+ '[RFC,1/2] meep')
+ self.assertEquals(clean_subject('[PATCH] [RFC] [1/2] meep'),
+ '[RFC,1/2] meep')
+ self.assertEquals(clean_subject('[PATCH] rewrite [a-z] regexes'),
+ 'rewrite [a-z] regexes')
+ self.assertEquals(clean_subject('[PATCH] [RFC] rewrite [a-z] regexes'),
+ '[RFC] rewrite [a-z] regexes')
+ self.assertEquals(clean_subject('[foo] [bar] meep', ['foo']),
+ '[bar] meep')
+ self.assertEquals(clean_subject('[FOO] [bar] meep', ['foo']),
+ '[bar] meep')