allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [10/13] git commit: [#7451] ticket:605 Test for remember me function
Date Fri, 25 Jul 2014 19:22:13 GMT
[#7451] ticket:605 Test for remember me function


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

Branch: refs/heads/master
Commit: a5cb9626ceae99595480646e46ef9a282fe147a7
Parents: 7b3b357
Author: Aleksey 'LXj' Alekseyev <gotletter@gmail.com>
Authored: Thu Jul 17 15:53:35 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Jul 25 18:43:28 2014 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_auth.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/a5cb9626/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 80c207c..58d824a 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -92,6 +92,29 @@ class TestAuth(TestController):
         assert_equal(user.last_access['login_ip'], 'addr')
         assert_equal(user.last_access['login_ua'], 'browser')
 
+    def test_rememberme(self):
+        userid = M.User.query.get(username='test-user')._id
+
+        # Login as test-user with remember me checkbox off
+        r = self.app.post('/auth/do_login', params=dict(
+            username='test-user', password='foo'))
+        assert_equal(r.session['userid'], userid)
+        assert_equal(r.session['login_expires'], True)
+
+        for header, contents in r.headerlist:
+            if header == 'Set-cookie':
+                assert_not_in('expires', contents)
+
+        # Login as test-user with remember me checkbox on
+        r = self.app.post('/auth/do_login', params=dict(
+            username='test-user', password='foo', rememberme='on'))
+        assert_equal(r.session['userid'], userid)
+        assert_not_equal(r.session['login_expires'], True)
+
+        for header, contents in r.headerlist:
+            if header == 'Set-cookie':
+                assert_in('expires', contents)
+
     @td.with_user_project('test-admin')
     def test_prefs(self):
         r = self.app.get('/auth/preferences/',


Mime
View raw message