aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/tests/test_auth.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index a3e2cac9..5ce67688 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -233,22 +233,6 @@ 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):
"""
Test logging in and logging out
@@ -351,6 +335,19 @@ def test_authentication_views(test_app):
'next' : '/u/chris/'})
assert urlparse.urlsplit(response.location)[2] == '/u/chris/'
+ ## Verify that username is lowercased on login attempt
+ template.clear_test_template_context()
+ response = test_app.post(
+ '/auth/login/', {
+ 'username': u'ANDREW',
+ 'password': 'fuselage'})
+ context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/auth/login.html']
+ form = context['login_form']
+
+ # Username should no longer be uppercased; it should be lowercased
+ assert not form.username.data == u'ANDREW'
+ assert form.username.data == u'andrew'
+
@pytest.fixture()
def authentication_disabled_app(request):
return get_app(