fixed form and tests updated
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -69,4 +69,5 @@ config.yaml
|
|||||||
/py2/
|
/py2/
|
||||||
/py38/
|
/py38/
|
||||||
/py39/
|
/py39/
|
||||||
|
/py39b/
|
||||||
/django2/
|
/django2/
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
|||||||
from .statements import *
|
from .statements import *
|
||||||
|
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
from django_recaptcha.client import RecaptchaResponse
|
||||||
|
|
||||||
from rowers.views import get_workout
|
from rowers.views import get_workout
|
||||||
|
|
||||||
@@ -69,7 +70,10 @@ class SimpleViewTest(TestCase):
|
|||||||
response = self.c.get(url)
|
response = self.c.get(url)
|
||||||
self.assertIn(response.status_code, [403, 404])
|
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)
|
login = self.c.login(username=self.u.username, password=self.password)
|
||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
@@ -80,18 +84,20 @@ class SimpleViewTest(TestCase):
|
|||||||
'lastname': 'Doe',
|
'lastname': 'Doe',
|
||||||
'email': 'roosendaalsander@gmail.com',
|
'email': 'roosendaalsander@gmail.com',
|
||||||
'subject': 'testing',
|
'subject': 'testing',
|
||||||
'botcheck': True,
|
'captcha': 'sdsdsdsdsdsdss',
|
||||||
|
'g-recaptcha-response': 'PASSED',
|
||||||
'message': faker.text()}
|
'message': faker.text()}
|
||||||
|
|
||||||
form = EmailForm(form_data)
|
form = EmailForm(form_data)
|
||||||
|
|
||||||
|
|
||||||
self.assertTrue(form.is_valid())
|
self.assertTrue(form.is_valid())
|
||||||
|
|
||||||
response = self.c.post(url, form_data, follow=True)
|
response = self.c.post(url, form_data, follow=True)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
self.assertRedirects(response,
|
self.assertRedirects(response,
|
||||||
expected_url='/rowers/email/',
|
expected_url='/rowers/email/thankyou/',
|
||||||
status_code=302, target_status_code=200)
|
status_code=302, target_status_code=200)
|
||||||
|
|
||||||
def test_getworkout(self):
|
def test_getworkout(self):
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -134,7 +134,7 @@
|
|||||||
175,220,rower_favoritecharts_view,See favorite charts,TRUE,302,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
175,220,rower_favoritecharts_view,See favorite charts,TRUE,302,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
176,222,workout_workflow_config2_view,configure workflow,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE,
|
176,222,workout_workflow_config2_view,configure workflow,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE,
|
||||||
177,224,workflow_default_view,resets workflow to default,TRUE,302,basic,302,302,FALSE,403,403,FALSE,302,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
177,224,workflow_default_view,resets workflow to default,TRUE,302,basic,302,302,FALSE,403,403,FALSE,302,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
178,225,sendmail,feedback form,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
178,225,sendmail,feedback form,TRUE,200,basic,200,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
180,232,laboratory_view,lab,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
180,232,laboratory_view,lab,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
181,233,errormessage_view,not used,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
181,233,errormessage_view,not used,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
182,237,payment_confirm_view,confirm payment,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
182,237,payment_confirm_view,confirm payment,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
|
|||||||
|
Reference in New Issue
Block a user