Browse Source

first view for account registration, alas without form

master
Holger Frey 7 years ago
parent
commit
7158d10549
  1. 15
      ordr2/templates/account/register.jinja2
  2. 14
      ordr2/views/account.py
  3. 21
      tests/_functional/account.py
  4. 2
      tests/_functional/layout_and_pages.py

15
ordr2/templates/account/register.jinja2

@ -0,0 +1,15 @@
{% extends "ordr2:templates/layout.jinja2" %}
{% block title %} Ordr | Account Registration {% endblock title %}
{% block content %}
<div class="row justify-content-center">
<div class="col-8">
<div class="jumbotron">
<h1>Account Registration</h1>
</div>
</div>
</div>
{% endblock content %}

14
ordr2/views/account.py

@ -0,0 +1,14 @@
''' account registration, login, logout and settings '''
from pyramid.view import view_config
@view_config(
context='ordr2:resources.account.AccountResource',
name='register',
permission='register',
renderer='ordr2:templates/account/register.jinja2'
)
def register(context, request):
''' the new user registraion page '''
return {}

21
tests/_functional/account.py

@ -0,0 +1,21 @@
''' tests for the common layout and simple (static)'''
from . import testapp
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
assert '<!-- No logged in user -->' 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'

2
tests/_functional/layout_and_pages.py

@ -25,7 +25,7 @@ def test_faq_unauthenticated(testapp):
# basic content test # basic content test
assert 'Ordr | FAQ' in response assert 'Ordr | FAQ' in response
assert '<!-- No logged in user -->' in response assert '<!-- No logged in user -->' in response
# test that the first section links and highlighting # test the main nav section links and highlighting
li_one, li_two = response.html.find_all('li', class_='nav-item') li_one, li_two = response.html.find_all('li', class_='nav-item')
assert 'active' in li_one['class'] assert 'active' in li_one['class']
assert li_one.find('a').text == 'FAQs' assert li_one.find('a').text == 'FAQs'