def test_email_format_and_content(self): ReportFactory.create(email='*****@*****.**', comment="This is a 'comment'") sent_mail = mail.outbox[0] self.assertEqual(sent_mail.subject, '[Geotrek] Feedback from [email protected]') self.assertIn("Comment : This is a 'comment'", sent_mail.body) self.assertIn("Lat : 46.500000 / Lon : 3.000000", sent_mail.body)
def test_email_format_and_content(self): ReportFactory.create(name=u'John Doe', email=u'*****@*****.**', comment=u'This is a comment') sent_mail = mail.outbox[0] self.assertEquals(sent_mail.subject, u'[Geotrek] Feedback from John Doe ([email protected])') self.assertIn(u"Comment : This is a comment", sent_mail.body) self.assertIn(u"Lat : 1.13 / Lon : 2.26", sent_mail.body)
def test_email_format_and_content(self): ReportFactory.create(name=u'John Doe', email=u'*****@*****.**', comment=u'This is a comment') sent_mail = mail.outbox[0] self.assertEquals( sent_mail.subject, u'[Geotrek] Feedback from John Doe ([email protected])') self.assertIn(u"Comment : This is a comment", sent_mail.body) self.assertIn(u"Lat : 46.5 / Lon : 3", sent_mail.body)
def test_email_format_and_content_fr(self): translation.activate('fr') ReportFactory.create(email='*****@*****.**', comment="Ceci est un commentaire") sent_mail = mail.outbox[0] self.assertEqual( sent_mail.subject, '[Geotrek] Signalement de [email protected]') self.assertIn("Commentaire : Ceci est un commentaire", sent_mail.body) self.assertIn("Lat : 46.500000 / Lon : 3.000000", sent_mail.body) self.assertIn( "http://www.openstreetmap.org/?mlat=46.500000&mlon=3.000000", sent_mail.body) translation.deactivate()
def test_email_format_and_content(self): ReportFactory.create(name=u"John Doe", email=u"*****@*****.**", comment=u"This is a comment") sent_mail = mail.outbox[0] self.assertEquals(sent_mail.subject, u"[Geotrek] Feedback from John Doe ([email protected])") self.assertIn(u"Comment : This is a comment", sent_mail.body) self.assertIn(u"Lat : 46.5 / Lon : 3", sent_mail.body)
def test_email_failure_does_not_prevent_report_creation(self): r = ReportFactory.create() self.assertEquals(len(mail.outbox), 0) self.assertIsNotNone(r.id)
def test_a_mail_is_not_sent_on_report_modification(self): r = ReportFactory.create() self.assertEquals(len(mail.outbox), 1) r.name = "toto" r.save() self.assertEquals(len(mail.outbox), 1)
def test_a_mail_is_sent_on_report_creation(self): ReportFactory.create() self.assertEquals(len(mail.outbox), 1)
def test_email_failure_does_not_prevent_report_creation(self): r = ReportFactory.create() self.assertEquals(len(mail.outbox), 0) self.assertIsNotNone(r.id)
def test_a_mail_is_not_sent_on_report_modification(self): r = ReportFactory.create() self.assertEquals(len(mail.outbox), 1) r.name = 'toto' r.save() self.assertEquals(len(mail.outbox), 1)
def test_a_mail_is_sent_on_report_creation(self): ReportFactory.create() self.assertEquals(len(mail.outbox), 1)
def test_a_mail_is_not_sent_on_report_modification(self): r = ReportFactory.create() self.assertEqual(len(mail.outbox), 1) r.comment = 'More info about it' r.save() self.assertEqual(len(mail.outbox), 1)