summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 13:42:24 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 13:42:24 +0200
commite546500a17c6a8eb2c66657c12958248203c60dc (patch)
treea169c45a45974e7b37298c6114bd0c697c1c9522 /mail
parentae1a4647f0ab67953cea88eee45fc4d1eabc2dbc (diff)
[bug] Fix missing _normailize_dict in DocumentWrapper constructor.
In the constructor values already is normalized (i.e. with underscores), while kwargs contains items that are not normalized (i.e. with dashes). Joining the dicts resulted in two entries that only differed by dash or underscores. The setattr then set the value that occurred later in items, thereby sometimes overriding the correct value with the default one.
Diffstat (limited to 'mail')
-rw-r--r--mail/src/leap/mail/adaptors/models.py2
-rw-r--r--mail/src/leap/mail/adaptors/tests/test_soledad_adaptor.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/mail/src/leap/mail/adaptors/models.py b/mail/src/leap/mail/adaptors/models.py
index 2bf9e60..49460f7 100644
--- a/mail/src/leap/mail/adaptors/models.py
+++ b/mail/src/leap/mail/adaptors/models.py
@@ -76,7 +76,7 @@ class DocumentWrapper(object):
if kwargs:
values = copy.deepcopy(defaults)
- values.update(kwargs)
+ values.update(_normalize_dict(kwargs))
else:
values = defaults
diff --git a/mail/src/leap/mail/adaptors/tests/test_soledad_adaptor.py b/mail/src/leap/mail/adaptors/tests/test_soledad_adaptor.py
index 0ddea30..499c2b1 100644
--- a/mail/src/leap/mail/adaptors/tests/test_soledad_adaptor.py
+++ b/mail/src/leap/mail/adaptors/tests/test_soledad_adaptor.py
@@ -342,6 +342,7 @@ class SoledadMailAdaptorTestCase(SoledadTestMixin):
msg = adaptor.get_msg_from_string(TestMessageClass, msg.as_string())
self.assertEqual('base64', msg.wrapper.cdocs[1].content_transfer_encoding)
+ self.assertEqual('text/plain; charset="utf-8"', msg.wrapper.cdocs[1].content_type)
self.assertEqual('YSB1dGY4IG1lc3NhZ2U=\n', msg.wrapper.cdocs[1].raw)
def test_get_msg_from_docs(self):