From c7236fd0da6689c5f6ec5c3deb93f89069470610 Mon Sep 17 00:00:00 2001 From: ayleph Date: Wed, 17 Sep 2014 22:30:15 -0700 Subject: [PATCH] Unit tests Added unit tests for lowercasify username on login. --- mediagoblin/tests/test_auth.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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): """ -- 2.25.1