+
+class MboxDateHeaderTest(TestCase):
+ """ Test that the date provided in the patch mail view is correct """
+
+ 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()
+
+ def testDateHeader(self):
+ response = self.client.get('/patch/%d/mbox/' % self.patch.id)
+ mail = email.message_from_string(response.content)
+ mail_date = dateutil.parser.parse(mail['Date'])
+ # patch dates are all in UTC
+ patch_date = self.patch.date.replace(tzinfo=dateutil.tz.tzutc(),
+ microsecond=0)
+ self.assertEqual(mail_date, patch_date)