diff mbox series

Fix stuff around mbox header changes

Message ID 20180410143044.12503-1-vkabatov@redhat.com
State Accepted
Headers show
Series Fix stuff around mbox header changes | expand

Commit Message

Veronika Kabatova April 10, 2018, 2:30 p.m. UTC
From: Veronika Kabatova <vkabatov@redhat.com>

Bundle tests got broken after the subject in mbox was changed from the
parsed version to the original one because the tests checked for the
presence of patch's name in the response. Fixing this turned out to be
a bit tricky since the tests check the mbox attachment and HTML
responses separately, so we need a string that would be present in both
(the intuitive idea of checking X-Patchwork-Id won't work well).

Add the patch's name to the content of the test patch so we can continue
testing things the same way, checking for the presence of patch's name.

Also add a releasenote notifying about the inclusion of the original
headers.

Reverts: b2a25342 ("Use parsed subject for mboxes")
Fixes: 01b9cbb9 ("Include all email headers in mboxes")
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
---
 patchwork/tests/utils.py                              | 2 +-
 patchwork/views/utils.py                              | 3 ---
 releasenotes/notes/mbox-headers-27e1f1bde9570e9f.yaml | 6 ++++++
 3 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 releasenotes/notes/mbox-headers-27e1f1bde9570e9f.yaml

Comments

Stephen Finucane April 11, 2018, 3:09 p.m. UTC | #1
On Tue, 2018-04-10 at 16:30 +0200, vkabatov@redhat.com wrote:
> From: Veronika Kabatova <vkabatov@redhat.com>
> 
> Bundle tests got broken after the subject in mbox was changed from the
> parsed version to the original one because the tests checked for the
> presence of patch's name in the response. Fixing this turned out to be
> a bit tricky since the tests check the mbox attachment and HTML
> responses separately, so we need a string that would be present in both
> (the intuitive idea of checking X-Patchwork-Id won't work well).
> 
> Add the patch's name to the content of the test patch so we can continue
> testing things the same way, checking for the presence of patch's name.
> 
> Also add a releasenote notifying about the inclusion of the original
> headers.
> 
> Reverts: b2a25342 ("Use parsed subject for mboxes")
> Fixes: 01b9cbb9 ("Include all email headers in mboxes")
> Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>

Yup, this looks good to me.

Reviewed-by: Stephen Finucane <stephen@that.guru>

and applied.
diff mbox series

Patch

diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py
index eb14a7d..00eb6c2 100644
--- a/patchwork/tests/utils.py
+++ b/patchwork/tests/utils.py
@@ -172,7 +172,7 @@  def create_patch(**kwargs):
         'state': create_state() if 'state' not in kwargs else None,
         'name': 'testpatch%d' % num,
         'headers': '',
-        'content': '',
+        'content': 'Patch testpatch%d' % num,
         'diff': SAMPLE_DIFF,
     }
     values.update(kwargs)
diff --git a/patchwork/views/utils.py b/patchwork/views/utils.py
index 7f89004..f5ff43c 100644
--- a/patchwork/views/utils.py
+++ b/patchwork/views/utils.py
@@ -101,9 +101,6 @@  def _submission_to_mbox(submission):
     for key, val in orig_headers.items():
         mail[key] = val
 
-    # specifically overwrite the subject with our own nicely formatted name
-    mail['Subject'] = submission.name
-
     if 'Date' not in mail:
         mail['Date'] = email.utils.formatdate(utc_timestamp)
 
diff --git a/releasenotes/notes/mbox-headers-27e1f1bde9570e9f.yaml b/releasenotes/notes/mbox-headers-27e1f1bde9570e9f.yaml
new file mode 100644
index 0000000..7564118
--- /dev/null
+++ b/releasenotes/notes/mbox-headers-27e1f1bde9570e9f.yaml
@@ -0,0 +1,6 @@ 
+---
+other:
+  - |
+    mbox files now contain all headers from the original email. This also means
+    the ``Subject: `` header included will contain the original subject and not
+    the parsed Patchwork's version.