Holger Frey
7 years ago
29 changed files with 485 additions and 77 deletions
@ -0,0 +1,36 @@ |
|||||||
|
{% extends "ordr:templates/layout.jinja2" %} |
||||||
|
|
||||||
|
{% block title %} Ordr | Registration {% endblock title %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-6"> |
||||||
|
<h1>Registration</h1> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-secondary"> |
||||||
|
Step 1: Registration |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-secondary"> |
||||||
|
Step 2: Validate Email |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-primary"> |
||||||
|
Step 3: Finished |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-6"> |
||||||
|
<h3>Registration Completed</h3> |
||||||
|
<p class="mt-3">Thank you for verifying your email address.</p> |
||||||
|
<p>Before you can start ordering, an administrator must activate your account</p> |
||||||
|
<p>You'll receive an email when your account is activated</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endblock content %} |
@ -0,0 +1,35 @@ |
|||||||
|
{% extends "ordr:templates/layout.jinja2" %} |
||||||
|
|
||||||
|
{% block title %} Ordr | Registration {% endblock title %} |
||||||
|
|
||||||
|
{% block content %} |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-6"> |
||||||
|
<h1>Registration</h1> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-secondary"> |
||||||
|
Step 1: Registration |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-primary"> |
||||||
|
Step 2: Validate Email |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<div class="col-2"> |
||||||
|
<p class="text-secondary"> |
||||||
|
Step 3: Finished |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="row justify-content-md-center mt-3"> |
||||||
|
<div class="col-6"> |
||||||
|
<h3>Verify Your Email Address</h3> |
||||||
|
<p class="mt-3">To complete the registration process an email has been sent to you.</p> |
||||||
|
<p>Please follow the link in the email to verify your address and complete the registration process.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endblock content %} |
@ -1,9 +1,47 @@ |
|||||||
''' functional tests for ordr2.views.registration ''' |
''' functional tests for ordr2.views.registration ''' |
||||||
|
|
||||||
from . import testappsetup, testapp # noqa: F401 |
from pyramid_mailer import get_mailer |
||||||
|
|
||||||
|
from . import testappsetup, testapp, get_token_url # noqa: F401 |
||||||
|
|
||||||
|
|
||||||
def test_registration_form(testapp): # noqa: F811 |
def test_registration_form(testapp): # noqa: F811 |
||||||
result = testapp.get('/register') |
response = testapp.get('/register') |
||||||
active = result.html.find('li', class_='active') |
active = response.html.find('li', class_='active') |
||||||
assert active.a['href'] == '/register' |
assert active.a['href'] == '/register' |
||||||
|
|
||||||
|
|
||||||
|
def test_registration_form_invalid(testapp): # noqa: F811 |
||||||
|
response = testapp.get('/register') |
||||||
|
|
||||||
|
form = response.form |
||||||
|
form['email'] = 'not an email address' |
||||||
|
response = form.submit(name='create') |
||||||
|
|
||||||
|
assert 'Invalid email address' in response |
||||||
|
|
||||||
|
|
||||||
|
def test_registration_process(testapp): # noqa: F811 |
||||||
|
response = testapp.get('/register') |
||||||
|
|
||||||
|
form = response.form |
||||||
|
form['username'] = 'AmyMcDonald', |
||||||
|
form['first_name'] = 'Amy', |
||||||
|
form['last_name'] = 'Mc Donald', |
||||||
|
form['email'] = 'amy.mcdonald@example.com', |
||||||
|
form['password'] = 'Make Amy McDonald A Rich Girl Fund', |
||||||
|
form['password-confirm'] = 'Make Amy McDonald A Rich Girl Fund', |
||||||
|
response = form.submit(name='create') |
||||||
|
assert response.location == 'http://localhost/register/verify' |
||||||
|
|
||||||
|
response = response.follow() |
||||||
|
assert 'Please follow the link in the email' in response |
||||||
|
|
||||||
|
# click the email verification token |
||||||
|
mailer = get_mailer(testapp.app.registry) |
||||||
|
email = mailer.outbox[-1] |
||||||
|
assert email.subject == '[ordr] Please verify your email address' |
||||||
|
|
||||||
|
token_link = get_token_url(email, prefix='/register/') |
||||||
|
response = testapp.get(token_link) |
||||||
|
assert 'Registration Completed' in response |
||||||
|
Reference in new issue