add test for new user registration
This commit is contained in:
@@ -244,6 +244,10 @@ def handle_sendemail_invite(email,name,code,teamname,manager):
|
|||||||
message = 'Dear '+name+',\n\n'
|
message = 'Dear '+name+',\n\n'
|
||||||
message += manager+' is inviting you to join his team '+teamname
|
message += manager+' is inviting you to join his team '+teamname
|
||||||
message += ' on rowsandall.com\n\n'
|
message += ' on rowsandall.com\n\n'
|
||||||
|
message += 'By accepting the invite, you will have access to your'
|
||||||
|
message += " team's workouts on rowsandall.com and your workouts will "
|
||||||
|
message += " be visible to "
|
||||||
|
message += "the members of the team.\n\n"
|
||||||
message += 'If you already have an account on rowsandall.com, you can login to the site and you will find the invitation here on the Teams page:\n'
|
message += 'If you already have an account on rowsandall.com, you can login to the site and you will find the invitation here on the Teams page:\n'
|
||||||
message += ' https://rowsandall.com/rowers/me/teams \n\n'
|
message += ' https://rowsandall.com/rowers/me/teams \n\n'
|
||||||
message += 'You can also click the direct link: \n'
|
message += 'You can also click the direct link: \n'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from django.test import TestCase, Client,override_settings
|
|||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from .views import checkworkoutuser,c2_open
|
from .views import checkworkoutuser,c2_open
|
||||||
from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage
|
from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage
|
||||||
from rowers.forms import DocumentsForm,CNsummaryForm
|
from rowers.forms import DocumentsForm,CNsummaryForm,RegistrationFormUniqueEmail
|
||||||
import rowers.plots as plots
|
import rowers.plots as plots
|
||||||
import rowers.interactiveplots as iplots
|
import rowers.interactiveplots as iplots
|
||||||
import datetime
|
import datetime
|
||||||
@@ -276,6 +276,31 @@ class TestErrorPages(TestCase):
|
|||||||
self.assertEqual(response.status_code, 500)
|
self.assertEqual(response.status_code, 500)
|
||||||
self.assertIn('500 Internal Server Error', unicode(response))
|
self.assertIn('500 Internal Server Error', unicode(response))
|
||||||
|
|
||||||
|
class NewUserRegistrationTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.c = Client()
|
||||||
|
|
||||||
|
def test_newuser(self):
|
||||||
|
form_data = {
|
||||||
|
'first_name':'Jan',
|
||||||
|
'last_name':'Roeiert',
|
||||||
|
'email':'jan@loop.nl',
|
||||||
|
'username':'janderoeiert',
|
||||||
|
'password1':'aapindewei2',
|
||||||
|
'password2':'aapindewei2',
|
||||||
|
'tos':True,
|
||||||
|
}
|
||||||
|
|
||||||
|
form = RegistrationFormUniqueEmail(form_data)
|
||||||
|
self.assertTrue(form.is_valid())
|
||||||
|
|
||||||
|
response = self.c.post('/rowers/register', form_data, follow=True)
|
||||||
|
|
||||||
|
self.assertRedirects(response,
|
||||||
|
expected_url='/rowers/register/thankyou/',
|
||||||
|
status_code=302,target_status_code=200)
|
||||||
|
|
||||||
|
|
||||||
class WorkoutTests(TestCase):
|
class WorkoutTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
u = User.objects.create_user('john',
|
u = User.objects.create_user('john',
|
||||||
|
|||||||
Reference in New Issue
Block a user