From 7158d105499dc6362f7627eb8062dc5a388878d9 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 16 Oct 2017 17:57:36 +0200 Subject: [PATCH] first view for account registration, alas without form --- ordr2/templates/account/register.jinja2 | 15 +++++++++++++++ ordr2/views/account.py | 14 ++++++++++++++ tests/_functional/account.py | 21 +++++++++++++++++++++ tests/_functional/layout_and_pages.py | 2 +- 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 ordr2/templates/account/register.jinja2 create mode 100644 ordr2/views/account.py create mode 100644 tests/_functional/account.py diff --git a/ordr2/templates/account/register.jinja2 b/ordr2/templates/account/register.jinja2 new file mode 100644 index 0000000..6164320 --- /dev/null +++ b/ordr2/templates/account/register.jinja2 @@ -0,0 +1,15 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block title %} Ordr | Account Registration {% endblock title %} + +{% block content %} +
+
+ +
+

Account Registration

+
+ +
+
+{% endblock content %} diff --git a/ordr2/views/account.py b/ordr2/views/account.py new file mode 100644 index 0000000..f0d6dfc --- /dev/null +++ b/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 {} diff --git a/tests/_functional/account.py b/tests/_functional/account.py new file mode 100644 index 0000000..9619fc8 --- /dev/null +++ b/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 '' 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' + diff --git a/tests/_functional/layout_and_pages.py b/tests/_functional/layout_and_pages.py index 7b8bf73..3c9777f 100644 --- a/tests/_functional/layout_and_pages.py +++ b/tests/_functional/layout_and_pages.py @@ -25,7 +25,7 @@ def test_faq_unauthenticated(testapp): # basic content test assert 'Ordr | FAQ' in response assert '' 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') assert 'active' in li_one['class'] assert li_one.find('a').text == 'FAQs'