aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_auth.py
diff options
context:
space:
mode:
authorCaleb Forbes Davis V <caldavis@gmail.com>2011-09-05 18:57:06 -0500
committerCaleb Forbes Davis V <caldavis@gmail.com>2011-09-05 18:57:06 -0500
commit4bcaf9f32ab7e125a8db8deece4f292fed71e291 (patch)
tree91c048301384b54bb5de3dc2bab39d6b8e1d7567 /mediagoblin/tests/test_auth.py
parent65a8304794f5ad694799454c0337675708b10906 (diff)
downloadmediagoblin-4bcaf9f32ab7e125a8db8deece4f292fed71e291.tar.lz
mediagoblin-4bcaf9f32ab7e125a8db8deece4f292fed71e291.tar.xz
mediagoblin-4bcaf9f32ab7e125a8db8deece4f292fed71e291.zip
for readability, and adds unit test for expired token
Diffstat (limited to 'mediagoblin/tests/test_auth.py')
-rw-r--r--mediagoblin/tests/test_auth.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index a8e2d123..bfa66bd2 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -281,6 +281,16 @@ def test_register_views(test_app):
new_user['_id']), status=400)
assert response.status == '400 Bad Request'
+ ## Try using an expired token to change password, shouldn't work
+ util.clear_test_template_context()
+ real_token_expiration = new_user['fp_token_expire']
+ new_user['fp_token_expire'] = datetime.datetime.now()
+ new_user.save()
+ response = test_app.get("%s?%s" % (path, get_params), status=400)
+ assert response.status == '400 Bad Request'
+ new_user['fp_token_expire'] = real_token_expiration
+ new_user.save()
+
## Verify step 1 of password-change works -- can see form to change password
util.clear_test_template_context()
response = test_app.get("%s?%s" % (path, get_params))