Browse Source

split functional tests for accounts in two modules

master
Holger Frey 7 years ago
parent
commit
21e33b3a3d
  1. 18
      tests/_functional/login-logout.py
  2. 33
      tests/_functional/registration.py

18
tests/_functional/account.py → tests/_functional/login-logout.py

@ -23,24 +23,6 @@ def assert_user_login_failed(response, username):
assert 'You entered the wrong username or password' in response assert 'You entered the wrong username or password' in response
# test for account registration
def test_account_register_unauthenticated(testapp):
''' test the registration page for a unauthenticated user '''
testapp.reset()
response = testapp.get('/account/register')
# basic content test
assert 'Ordr | Account Registration' in response
# test the main nav section links and highlighting
li_one, li_two = response.html.find_all('li', class_='nav-item')
assert 'active' not in li_one['class']
assert li_one.find('a').text == 'FAQs'
assert 'active' in li_two['class']
assert li_two.find('a').text == 'Register'
# tests for login and logout of users # tests for login and logout of users
def test_account_login_only_by_post(testapp): def test_account_login_only_by_post(testapp):

33
tests/_functional/registration.py

@ -0,0 +1,33 @@
''' tests for the login, logout, registration and account settings'''
import pytest
from . import testapp
from .. import get_user
def test_account_register_authenticated_users(testapp):
''' registration page should not be accessible for authenticated users '''
testapp.reset()
testapp.login('user')
response = testapp.get('/account/register', status=403)
assert response.status.startswith('403')
def test_account_register_unauthenticated(testapp):
''' test the registration page for a unauthenticated user '''
testapp.reset()
response = testapp.get('/account/register')
# basic content test
assert 'Ordr | Account Registration' in response
# test the main nav section links and highlighting
li_one, li_two = response.html.find_all('li', class_='nav-item')
assert 'active' not in li_one['class']
assert li_one.find('a').text == 'FAQs'
assert 'active' in li_two['class']
assert li_two.find('a').text == 'Register'