aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_auth.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-06-05 18:14:48 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-06-05 18:14:48 -0500
commit8a869db8e46d120ff12854462e828220cd5ebf6a (patch)
tree83a16c4f631a99ee4037d9d96465c02cd0ec9c03 /mediagoblin/tests/test_auth.py
parent7b1e17ed0d3224e997507e1ef14a111577b8b7b1 (diff)
downloadmediagoblin-8a869db8e46d120ff12854462e828220cd5ebf6a.tar.lz
mediagoblin-8a869db8e46d120ff12854462e828220cd5ebf6a.tar.xz
mediagoblin-8a869db8e46d120ff12854462e828220cd5ebf6a.zip
Make sure that two users with the same username can't register.
Diffstat (limited to 'mediagoblin/tests/test_auth.py')
-rw-r--r--mediagoblin/tests/test_auth.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index 4009c466..0f954ee0 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -213,5 +213,18 @@ def test_register_views():
# Uniqueness checks
# -----------------
## We shouldn't be able to register with that user twice
+ util.clear_test_template_context()
+ response = test_app.post(
+ '/auth/register/', {
+ 'username': 'happygirl',
+ 'password': 'iamsohappy2',
+ 'confirm_password': 'iamsohappy2',
+ 'email': 'happygrrl2@example.org'})
+
+ context = util.TEMPLATE_TEST_CONTEXT[
+ 'mediagoblin/auth/register.html']
+ form = context['register_form']
+ assert form.username.errors == [
+ u'Sorry, a user with that name already exists.']
- ## Also check for double instances of an email address
+ ## TODO: Also check for double instances of an email address?