You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/07 22:07:24 UTC

[11/14] git commit: [#6783] ticket:463 Fix expiry test

[#6783] ticket:463 Fix expiry test


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a6f4e769
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a6f4e769
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a6f4e769

Branch: refs/heads/master
Commit: a6f4e7696f84a492380740c0045b6ca595868825
Parents: ef881f0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Nov 4 13:36:49 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Nov 7 21:05:04 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_auth.py | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a6f4e769/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 02f26a9..672bba8 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -776,14 +776,12 @@ To reset your password on %s, please visit the following URL:
             assert_equal(hash, '')
             assert_equal(hash_expiry, '')
 
-            #r = self.app.post('/auth/password_recovery_hash', {'email': email._id})
-            #hash_expiry = user.get_tool_data('AuthPasswordReset', 'hash_expiry')
-            #user.set_tool_data('AuthPasswordReset', hash_expiry=hash_expiry-datetime.timedelta(hours=1))
-            #ThreadLocalORMSession.flush_all()
-            # expected redirect with error here, but
-            # real db-record of hash expiry doesn't changes.
-            #r = self.app.post('/auth/forgotten_password/%s' % hash.encode('utf'), {'pw': '154321', 'pw2': '154321'})
-
+            r = self.app.post('/auth/password_recovery_hash', {'email': email._id})
+            user = M.User.by_username('test-admin')
+            hash = user.get_tool_data('AuthPasswordReset', 'hash')
+            user.set_tool_data('AuthPasswordReset', hash_expiry= datetime.datetime(2000, 10, 10))
+            r = self.app.post('/auth/forgotten_password/%s' % hash.encode('utf-8'), {'pw': '154321', 'pw2': '154321'})
+            assert_in('Hash time was expired', r.follow().body)
 
 
 class TestOAuth(TestController):