def test_can_be_related_to_an_answe(self): '''A raw mail can be related to an answer''' answer = Answer.objects.get(id=1) with self.assertRaises(RawIncomingEmail.DoesNotExist): answer.raw_email raw_email = RawIncomingEmail(content=self.email_content) raw_email.answer = answer raw_email.save() answer = Answer.objects.get(id=answer.id) self.assertTrue(answer.raw_email) self.assertEquals(answer.raw_email, raw_email)
def test_can_be_related_to_an_answe(self): '''A raw mail can be related to an answer''' answer = Answer.objects.get(id=1) with self.assertRaises(RawIncomingEmail.DoesNotExist): answer.raw_email raw_email = RawIncomingEmail(content=self.email_content) raw_email.answer = answer raw_email.save() answer = Answer.objects.get(id=answer.id) self.assertTrue(answer.raw_email) self.assertEquals(answer.raw_email, raw_email)
def test_it_relates_the_raw_mail_to_an_instance(self): '''The raw message can be related to an instance''' instance = WriteItInstance.objects.get(id=1) raw_email = RawIncomingEmail(content=self.email_content) raw_email.writeitinstance = instance raw_email.save() instance = WriteItInstance.objects.get(id=instance.id) raw_emails = instance.raw_emails.all() self.assertTrue(raw_emails) self.assertIn(raw_email, raw_emails)
def test_it_relates_the_raw_mail_to_an_instance(self): '''The raw message can be related to an instance''' instance = WriteItInstance.objects.get(id=1) raw_email = RawIncomingEmail(content=self.email_content) raw_email.writeitinstance = instance raw_email.save() instance = WriteItInstance.objects.get(id=instance.id) raw_emails = instance.raw_emails.all() self.assertTrue(raw_emails) self.assertIn(raw_email, raw_emails)