aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_auth.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-06-05 10:34:29 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-06-05 10:34:29 -0500
commit460ce56493442b1d89270313e7789fd455ef71e6 (patch)
treeba952093adfd620a66f5389d5c6d8cf40318cf4a /mediagoblin/tests/test_auth.py
parent0a791a94de138f1a80989f46856bfd2ccd56e1c7 (diff)
downloadmediagoblin-460ce56493442b1d89270313e7789fd455ef71e6.tar.lz
mediagoblin-460ce56493442b1d89270313e7789fd455ef71e6.tar.xz
mediagoblin-460ce56493442b1d89270313e7789fd455ef71e6.zip
The first bit of the registration tests working. Not fully there, but
it's clear that the webtest part is working, without having tested the database yet. :)
Diffstat (limited to 'mediagoblin/tests/test_auth.py')
-rw-r--r--mediagoblin/tests/test_auth.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index 94ce6bba..b0355732 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -17,6 +17,10 @@
from mediagoblin.auth import lib as auth_lib
+from mediagoblin.tests.tools import get_test_app
+
+from mediagoblin import util
+
########################
# Test bcrypt auth funcs
@@ -57,3 +61,25 @@ def test_bcrypt_gen_password_hash():
pw, hashed_pw, '3><7R45417')
assert not auth_lib.bcrypt_check_password(
'notthepassword', hashed_pw, '3><7R45417')
+
+
+def test_register_views():
+ util.clear_test_template_context()
+ test_app = get_test_app()
+
+ # Test doing a simple GET on the page
+ test_app.get('/auth/register/')
+ # Make sure it rendered with the appropriate template
+ assert util.TEMPLATE_TEST_CONTEXT.has_key(
+ 'mediagoblin/auth/register.html')
+
+ # Try to register without providing anything, should error
+ util.clear_test_template_context()
+ test_app.post(
+ '/auth/register/', {})
+ context = util.TEMPLATE_TEST_CONTEXT['mediagoblin/auth/register.html']
+ form = context['register_form']
+ assert form.username.errors == [u'This field is required.']
+ assert form.password.errors == [u'This field is required.']
+ assert form.confirm_password.errors == [u'This field is required.']
+ assert form.email.errors == [u'This field is required.']