Make sure that two users with the same username can't register.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 5 Jun 2011 23:14:48 +0000 (18:14 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 5 Jun 2011 23:14:48 +0000 (18:14 -0500)
mediagoblin/tests/test_auth.py

index 4009c466a62136ca5e934bcd419d020803e53f04..0f954ee002a6c9414a9c2848aa6971df64fbd029 100644 (file)
@@ -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?