diff options
| author | José Antonio de la Torre <jose.torre.heras@gmail.com> | 2019-10-19 09:28:32 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2019-10-19 12:30:31 +0200 |
| commit | 28440d15ab603a655125a3927eaa3a0499474396 (patch) | |
| tree | 33a76af0db67daf5f29e357d52ffbc5ba3024c9c /ihatemoney/tests | |
| parent | 4b18be97e66f341a403df3b8c3e5788a4933363a (diff) | |
| download | ihatemoney-mirror-28440d15ab603a655125a3927eaa3a0499474396.zip ihatemoney-mirror-28440d15ab603a655125a3927eaa3a0499474396.tar.gz ihatemoney-mirror-28440d15ab603a655125a3927eaa3a0499474396.tar.bz2 | |
Added test
Diffstat (limited to 'ihatemoney/tests')
| -rw-r--r-- | ihatemoney/tests/tests.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ihatemoney/tests/tests.py b/ihatemoney/tests/tests.py index 1767475..11211bc 100644 --- a/ihatemoney/tests/tests.py +++ b/ihatemoney/tests/tests.py @@ -281,6 +281,46 @@ class BudgetTestCase(IhatemoneyTestCase): # no new project added self.assertEqual(len(models.Project.query.all()), 1) + def test_project_creation_without_public_permissions(self): + self.app.config["ALLOW_PUBLIC_PROJECT_CREATION"] = False + with self.app.test_client() as c: + # add a valid project + c.post( + "/create", + data={ + "name": "The fabulous raclette party", + "id": "raclette", + "password": "party", + "contact_email": "raclette@notmyidea.org", + }, + ) + + # session is not updated + self.assertNotIn("raclette", session) + + # project is created + self.assertEqual(len(models.Project.query.all()), 0) + + def test_project_creation_with_public_permissions(self): + self.app.config["ALLOW_PUBLIC_PROJECT_CREATION"] = True + with self.app.test_client() as c: + # add a valid project + c.post( + "/create", + data={ + "name": "The fabulous raclette party", + "id": "raclette", + "password": "party", + "contact_email": "raclette@notmyidea.org", + }, + ) + + # session is updated + self.assertTrue(session["raclette"]) + + # project is created + self.assertEqual(len(models.Project.query.all()), 1) + def test_project_deletion(self): with self.app.test_client() as c: |
