diff options
author | Lisa Junger <ljunger@thoughtworks.com> | 2015-04-02 09:55:07 +0200 |
---|---|---|
committer | Lisa Junger <ljunger@thoughtworks.com> | 2015-04-02 17:54:21 +0200 |
commit | f11d9b2811373de173f0e02ec334c85e46571172 (patch) | |
tree | dd814bf759e918e509f11d889f106ff0aa81a11b /service/test/unit/adapter | |
parent | db5a88affdf696b833619d18cbcfdd408f206150 (diff) |
when receiving invalid data for date header, fall back to datetime.now.
- Issue #347
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/test_mail.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py index 68b340a7..dc683bb6 100644 --- a/service/test/unit/adapter/test_mail.py +++ b/service/test/unit/adapter/test_mail.py @@ -67,6 +67,17 @@ class TestPixelatedMail(unittest.TestCase): self.assertEqual(str(mail.headers['Date']), leap_mail_date_in_iso_format) + def test_use_datetime_now_as_fallback_for_invalid_date(self): + leap_mail_date = 'söme däte' + date_expected = "2014-09-03T13:11:15-03:00" + when(pixelated.support.date).iso_now().thenReturn(date_expected) + + leap_mail = test_helper.leap_mail(headers={'date': leap_mail_date}) + + mail = PixelatedMail.from_soledad(*leap_mail, soledad_querier=self.querier) + + self.assertEqual(str(mail.headers['Date']), date_expected) + def test_update_tags_return_a_set_with_the_current_tags(self): soledad_docs = test_helper.leap_mail(extra_headers={'X-tags': '["custom_1", "custom_2"]'}) pixelated_mail = PixelatedMail.from_soledad(*soledad_docs, soledad_querier=self.querier) |