From 75209aeed0140c804047b4f3466d329b9eb246b9 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sat, 8 Oct 2011 15:52:12 +0200 Subject: Add a password recovery feature. Fix #32 --- budget/tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'budget/tests.py') diff --git a/budget/tests.py b/budget/tests.py index 2b573f4..a3fbd89 100644 --- a/budget/tests.py +++ b/budget/tests.py @@ -96,6 +96,24 @@ class BudgetTestCase(TestCase): self.assertEqual(len(outbox), 0) + def test_password_reminder(self): + # test that it is possible to have an email cotaining the password of a + # project in case people forget it (and it happens!) + + self.create_project("raclette") + + with run.mail.record_messages() as outbox: + # a nonexisting project should not send an email + self.app.post("/password-reminder", data={"id": "unexisting"}) + self.assertEqual(len(outbox), 0) + + # a mail should be sent when a project exists + self.app.post("/password-reminder", data={"id": "raclette"}) + self.assertEqual(len(outbox), 1) + self.assertIn("raclette", outbox[0].body) + self.assertIn("raclette@notmyidea.org", outbox[0].recipients) + + def test_project_creation(self): with run.app.test_client() as c: -- cgit v1.1