diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2011-12-08 22:00:43 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2011-12-08 22:09:00 +0800 |
commit | f32f0dafd7d9e53ac687660e8b353863545d5ce5 (patch) | |
tree | e58f56a6c76b39065ed0e13542a1aebd38bea79b | |
parent | a45a3fdfdb9706791ff36128399b302c4fa37c52 (diff) | |
download | patchwork-f32f0dafd7d9e53ac687660e8b353863545d5ce5.tar.bz2 patchwork-f32f0dafd7d9e53ac687660e8b353863545d5ce5.tar.xz |
tests: add abstract mbox parsing test
Add a new class to handle mbox-parsing code, abstracting what is done by
the current git-pull tests.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r-- | apps/patchwork/tests/patchparser.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/patchwork/tests/patchparser.py b/apps/patchwork/tests/patchparser.py index 5c8c412..296da5f 100644 --- a/apps/patchwork/tests/patchparser.py +++ b/apps/patchwork/tests/patchparser.py @@ -346,13 +346,15 @@ class ListIdHeaderTest(unittest.TestCase): def tearDown(self): self.project.delete() +class MBoxPatchTest(PatchTest): + def setUp(self): + self.mail = read_mail(self.mail_file, project = self.project) -class GitPullTest(PatchTest): +class GitPullTest(MBoxPatchTest): mail_file = '0001-git-pull-request.mbox' def testGitPullRequest(self): - mail = read_mail(self.mail_file, project = self.project) - (patch, comment) = find_content(self.project, mail) + (patch, comment) = find_content(self.project, self.mail) self.assertTrue(patch is not None) self.assertTrue(patch.pull_url is not None) self.assertTrue(patch.content is None) @@ -361,11 +363,11 @@ class GitPullTest(PatchTest): class GitPullWrappedTest(GitPullTest): mail_file = '0002-git-pull-request-wrapped.mbox' -class GitPullWithDiffTest(PatchTest): +class GitPullWithDiffTest(MBoxPatchTest): + mail_file = '0003-git-pull-request-with-diff.mbox' + def testGitPullWithDiff(self): - mail = read_mail('0003-git-pull-request-with-diff.mbox', - project = self.project) - (patch, comment) = find_content(self.project, mail) + (patch, comment) = find_content(self.project, self.mail) self.assertTrue(patch is not None) self.assertEqual('git://git.kernel.org/pub/scm/linux/kernel/git/tip/' + 'linux-2.6-tip.git x86-fixes-for-linus', patch.pull_url) |