-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ markers = [ | |
"factories", | ||
"models", | ||
"package", | ||
"register", | ||
"views", | ||
] | ||
testpaths = "tests" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<div metal:use-macro="load: layout.pt"> | ||
<div metal:fill-slot="content"> | ||
|
||
<h1>Register</h1> | ||
<span tal:replace="message"/> | ||
|
||
<form action="${request.route_url('register')}" method="post"> | ||
<label for="name">Full Name</label> | ||
<input type="text" id="name" | ||
name="name" | ||
value="${name}"/><br/> | ||
<label for="email">Email address</label> | ||
<input type="text" id="email" | ||
name="email" | ||
value="${email}"/><br/> | ||
<label for="password">Password</label> | ||
<input type="password" id="password" | ||
name="password" | ||
value="${password}"/><br/> | ||
<input type="submit" name="form.submitted" | ||
value="Register"/> | ||
</form> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
from pyramid import testing | ||
from pyramid.httpexceptions import HTTPFound | ||
|
||
from wfrp.character.application import DBSession | ||
from wfrp.character.models.user import User | ||
from wfrp.character.views.auth import AuthViews | ||
|
||
|
||
@pytest.mark.register | ||
def test_register(testapp): | ||
payload = { | ||
"name": "User Name", | ||
"email": "[email protected]", | ||
"password": "a_password", | ||
"form.submitted": "Register", | ||
} | ||
request = testing.DummyRequest(post=payload) | ||
response = AuthViews(request).register() | ||
assert isinstance(response, HTTPFound) | ||
users = DBSession.query(User).all() | ||
assert len(users) == 1 | ||
user = users[0] | ||
assert user.name == "User Name" | ||
assert user.email == "[email protected]" | ||
payload = { | ||
"login": "[email protected]", | ||
"password": "a_password", | ||
"form.submitted": "Log In", | ||
} | ||
request = testing.DummyRequest(post=payload) | ||
response = AuthViews(request).login() | ||
assert isinstance(response, HTTPFound) |