Fix registration related bugs #105

Merged
gergely merged 1 commits from registration-fixes into master 2018-07-23 10:59:55 +00:00
3 changed files with 9 additions and 18 deletions

View File

@ -25,4 +25,4 @@ def test_index_no_login(client):
"""
page = client.get('/')
assert b'Welcome to Calendar.social' in page.data
assert b'Peek inside' in page.data

View File

@ -23,14 +23,6 @@ from calsocial.models import db, User
from helpers import client, login
def test_index_no_login(client):
"""Test the main page without logging in
"""
page = client.get('/')
assert b'Welcome to Calendar.social' in page.data
def test_login_invalid_user(client):
"""Test logging in with a non-existing user
"""
@ -81,4 +73,4 @@ def test_login_first_steps(client):
assert page.location == 'http://localhost/'
page = client.get('/')
assert page.location == 'http://localhost/first-steps'
assert page.location == 'http://localhost/accounts/first-steps'

View File

@ -27,21 +27,21 @@ def test_register_page(client):
"""Test the registration page
"""
page = client.get('/register')
page = client.get('/accounts/register')
assert b'Register</button>' in page.data
def test_register_post_empty(client):
"""Test sending empty registration data
"""
page = client.post('/register', data={})
page = client.post('/accounts/register', data={})
assert b'This field is required' in page.data
def test_register_invalid_email(client):
"""Test sending an invalid email address
"""
page = client.post('/register', data={
page = client.post('/accounts/register', data={
'username': 'test',
'email': 'test',
'password': 'password',
@ -53,7 +53,7 @@ def test_register_password_mismatch(client):
"""Test sending different password for registration
"""
page = client.post('/register', data={
page = client.post('/accounts/register', data={
'username': 'test',
'email': 'test@example.com',
'password': 'password',
@ -65,13 +65,12 @@ def test_register(client):
"""Test user registration
"""
page = client.post('/register', data={
page = client.post('/accounts/register', data={
'username': 'test',
'email': 'test@example.com',
'password': 'password',
'password_retype': 'password',
})
print(page.data)
assert page.status_code == 302
assert page.location == 'http://localhost/'
@ -90,7 +89,7 @@ def test_register_existing_username(client):
db.session.add(user)
db.session.commit()
page = client.post('/register', data={
page = client.post('/accounts/register', data={
'username': 'test',
'email': 'test2@example.com',
'password': 'password',
@ -107,7 +106,7 @@ def test_register_existing_email(client):
db.session.add(user)
db.session.commit()
page = client.post('/register', data={
page = client.post('/accounts/register', data={
'username': 'tester',
'email': 'test@example.com',
'password': 'password',