fixed form and tests updated
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user