From patchwork Tue Nov 19 14:44:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 292587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id F2FBC2C033C for ; Wed, 20 Nov 2013 09:05:45 +1100 (EST) Received: from cyclops.biessmann.org (cyclops.biessmann.org [134.0.25.77]) by ozlabs.org (Postfix) with ESMTP id 02B9A2C012D for ; Wed, 20 Nov 2013 01:50:46 +1100 (EST) Received: from localhost (er.biessmann.org [80.81.14.92]) by cyclops.biessmann.org (Postfix) with ESMTPSA id F0EA3B6B68; Tue, 19 Nov 2013 15:42:23 +0100 (CET) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: patchwork@lists.ozlabs.org Subject: [PATCH 3/4] tests/mboxviews: test for unchanged postscript Date: Tue, 19 Nov 2013 15:44:01 +0100 Message-Id: <1384872242-18238-3-git-send-email-andreas@biessmann.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1384872242-18238-1-git-send-email-andreas@biessmann.de> References: <1384872242-18238-1-git-send-email-andreas@biessmann.de> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 20 Nov 2013 09:05:20 +1100 Cc: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.16rc2 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Currently a patch containing postscript is always modified in patch_to_mbox() compared to the input patch. A comment containing 'some comment\n---\n some/file | 1 +' will be changed to 'some comment\n\n---\nsome/file | 1 +\n' which is annoying. This patch adds a test to detect that, a follow up patch will fix the error then. Signed-off-by: Andreas Bießmann --- apps/patchwork/tests/mboxviews.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/patchwork/tests/mboxviews.py b/apps/patchwork/tests/mboxviews.py index 6209513..0e57f42 100644 --- a/apps/patchwork/tests/mboxviews.py +++ b/apps/patchwork/tests/mboxviews.py @@ -179,3 +179,31 @@ class MboxDateHeaderTest(TestCase): mail = email.message_from_string(response.content) mail_date = dateutil.parser.parse(mail['Date']) self.assertEqual(mail_date, date) + +class MboxCommentPostcriptUnchangedTest(TestCase): + """ Test that the mbox view doesn't change the postscript part of a mail. + There where always a missing blank right after the postscript + delimiter '---' and an additional newline right before. """ + def setUp(self): + defaults.project.save() + + self.person = defaults.patch_author_person + self.person.save() + + self.patch = Patch(project = defaults.project, + msgid = 'p1', name = 'testpatch', + submitter = self.person, content = '') + self.patch.save() + + self.txt = 'some comment\n---\n some/file | 1 +\n' + + comment = Comment(patch = self.patch, msgid = 'p1', + submitter = self.person, + content = self.txt) + comment.save() + + def testCommentUnchanged(self): + response = self.client.get('/patch/%d/mbox/' % self.patch.id) + self.assertContains(response, self.txt) + self.txt += "\n" + self.assertNotContains(response, self.txt)