[Bugfix] Fix broken tests
This commit is contained in:
parent
4c3ec0564f
commit
11bd30e01f
@ -25,4 +25,4 @@ def test_index_no_login(client):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
page = client.get('/')
|
page = client.get('/')
|
||||||
assert b'Welcome to Calendar.social' in page.data
|
assert b'Peek inside' in page.data
|
||||||
|
@ -23,14 +23,6 @@ from calsocial.models import db, User
|
|||||||
from helpers import client, login
|
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):
|
def test_login_invalid_user(client):
|
||||||
"""Test logging in with a non-existing user
|
"""Test logging in with a non-existing user
|
||||||
"""
|
"""
|
||||||
@ -81,4 +73,4 @@ def test_login_first_steps(client):
|
|||||||
assert page.location == 'http://localhost/'
|
assert page.location == 'http://localhost/'
|
||||||
|
|
||||||
page = client.get('/')
|
page = client.get('/')
|
||||||
assert page.location == 'http://localhost/first-steps'
|
assert page.location == 'http://localhost/accounts/first-steps'
|
||||||
|
@ -27,21 +27,21 @@ def test_register_page(client):
|
|||||||
"""Test the registration page
|
"""Test the registration page
|
||||||
"""
|
"""
|
||||||
|
|
||||||
page = client.get('/register')
|
page = client.get('/accounts/register')
|
||||||
assert b'Register</button>' in page.data
|
assert b'Register</button>' in page.data
|
||||||
|
|
||||||
def test_register_post_empty(client):
|
def test_register_post_empty(client):
|
||||||
"""Test sending empty registration data
|
"""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
|
assert b'This field is required' in page.data
|
||||||
|
|
||||||
def test_register_invalid_email(client):
|
def test_register_invalid_email(client):
|
||||||
"""Test sending an invalid email address
|
"""Test sending an invalid email address
|
||||||
"""
|
"""
|
||||||
|
|
||||||
page = client.post('/register', data={
|
page = client.post('/accounts/register', data={
|
||||||
'username': 'test',
|
'username': 'test',
|
||||||
'email': 'test',
|
'email': 'test',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
@ -53,7 +53,7 @@ def test_register_password_mismatch(client):
|
|||||||
"""Test sending different password for registration
|
"""Test sending different password for registration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
page = client.post('/register', data={
|
page = client.post('/accounts/register', data={
|
||||||
'username': 'test',
|
'username': 'test',
|
||||||
'email': 'test@example.com',
|
'email': 'test@example.com',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
@ -65,13 +65,12 @@ def test_register(client):
|
|||||||
"""Test user registration
|
"""Test user registration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
page = client.post('/register', data={
|
page = client.post('/accounts/register', data={
|
||||||
'username': 'test',
|
'username': 'test',
|
||||||
'email': 'test@example.com',
|
'email': 'test@example.com',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
'password_retype': 'password',
|
'password_retype': 'password',
|
||||||
})
|
})
|
||||||
print(page.data)
|
|
||||||
assert page.status_code == 302
|
assert page.status_code == 302
|
||||||
assert page.location == 'http://localhost/'
|
assert page.location == 'http://localhost/'
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ def test_register_existing_username(client):
|
|||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
page = client.post('/register', data={
|
page = client.post('/accounts/register', data={
|
||||||
'username': 'test',
|
'username': 'test',
|
||||||
'email': 'test2@example.com',
|
'email': 'test2@example.com',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
@ -107,7 +106,7 @@ def test_register_existing_email(client):
|
|||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
page = client.post('/register', data={
|
page = client.post('/accounts/register', data={
|
||||||
'username': 'tester',
|
'username': 'tester',
|
||||||
'email': 'test@example.com',
|
'email': 'test@example.com',
|
||||||
'password': 'password',
|
'password': 'password',
|
||||||
|
Loading…
Reference in New Issue
Block a user