Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Glandos committed Oct 10, 2021
1 parent 6a8e3eb commit cf8045a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions ihatemoney/tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,50 @@ def test_invitation_email_failure(self):
)


class CaptchaTestCase(IhatemoneyTestCase):
ENABLE_CAPTCHA = True

def test_project_creation_with_captcha(self):
with self.app.test_client() as c:
res = c.post(
"/create",
data={
"name": "raclette party",
"id": "raclette",
"password": "party",
"contact_email": "raclette@notmyidea.org",
"default_currency": "USD",
},
)
assert len(models.Project.query.all()) == 0

res = c.post(
"/create",
data={
"name": "raclette party",
"id": "raclette",
"password": "party",
"contact_email": "raclette@notmyidea.org",
"default_currency": "USD",
"captcha": "nope",
},
)
assert len(models.Project.query.all()) == 0

res = c.post(
"/create",
data={
"name": "raclette party",
"id": "raclette",
"password": "party",
"contact_email": "raclette@notmyidea.org",
"default_currency": "USD",
"captcha": "euro",
},
)
assert len(models.Project.query.all()) == 1


class TestCurrencyConverter(unittest.TestCase):
converter = CurrencyConverter()
mock_data = {"USD": 1, "EUR": 0.8, "CAD": 1.2, CurrencyConverter.no_currency: 1}
Expand Down

0 comments on commit cf8045a

Please sign in to comment.