Private
Public Access
1
0

fixed form and tests updated

This commit is contained in:
2024-05-23 13:50:54 +02:00
parent 1fef50fabf
commit d306bd5539
4 changed files with 11 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ from __future__ import unicode_literals
from .statements import *
from django.http import Http404
from django_recaptcha.client import RecaptchaResponse
from rowers.views import get_workout
@@ -69,7 +70,10 @@ class SimpleViewTest(TestCase):
response = self.c.get(url)
self.assertIn(response.status_code, [403, 404])
def test_sendmail(self):
@patch("django_recaptcha.fields.client.submit")
def test_sendmail(self, mocked_submit):
mocked_submit.return_value = RecaptchaResponse(is_valid=True, extra_data={"score":0.95})
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
@@ -80,18 +84,20 @@ class SimpleViewTest(TestCase):
'lastname': 'Doe',
'email': 'roosendaalsander@gmail.com',
'subject': 'testing',
'botcheck': True,
'captcha': 'sdsdsdsdsdsdss',
'g-recaptcha-response': 'PASSED',
'message': faker.text()}
form = EmailForm(form_data)
self.assertTrue(form.is_valid())
response = self.c.post(url, form_data, follow=True)
self.assertEqual(response.status_code, 200)
self.assertRedirects(response,
expected_url='/rowers/email/',
expected_url='/rowers/email/thankyou/',
status_code=302, target_status_code=200)
def test_getworkout(self):