aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_auth.py
diff options
context:
space:
mode:
authorayleph <ayleph@thisshitistemp.com>2014-09-17 22:30:15 -0700
committerChristopher Allan Webber <cwebber@dustycloud.org>2014-10-30 11:34:23 -0500
commitc7236fd0da6689c5f6ec5c3deb93f89069470610 (patch)
tree57985a55618c63fba65651c22d6c4524c31de9b7 /mediagoblin/tests/test_auth.py
parenta2b3c623fd53824ff84d9ac737636d30d0f52999 (diff)
downloadmediagoblin-c7236fd0da6689c5f6ec5c3deb93f89069470610.tar.lz
mediagoblin-c7236fd0da6689c5f6ec5c3deb93f89069470610.tar.xz
mediagoblin-c7236fd0da6689c5f6ec5c3deb93f89069470610.zip
Unit tests
Added unit tests for lowercasify username on login.
Diffstat (limited to 'mediagoblin/tests/test_auth.py')
-rw-r--r--mediagoblin/tests/test_auth.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index 7980953f..a3e2cac9 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -233,6 +233,21 @@ def test_register_views(test_app):
assert urlparse.urlsplit(response.location)[2] == '/'
assert 'mediagoblin/root.html' in template.TEMPLATE_TEST_CONTEXT
+ ## Verify that username is lowercased on login attempt
+ template.clear_test_template_context()
+ response = test_app.post(
+ '/auth/login/', {
+ 'username': u'ANGRYGIRL',
+ 'password': 'iamveryveryangry'})
+
+ # Username should no longer be uppercased; it should be lowercased
+ assert not form.username.data == u'ANGRYGIRL'
+ assert form.username.data == u'angrygirl'
+
+ # User should be redirected
+ response.follow()
+ assert urlparse.urlsplit(response.location)[2] == '/'
+ assert 'mediagoblin/root.html' in template.TEMPLATE_TEST_CONTEXT
def test_authentication_views(test_app):
"""