Holger Frey
7 years ago
2 changed files with 33 additions and 18 deletions
@ -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' |
||||||
|
|
Reference in new issue