You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/06/20 17:52:22 UTC

[05/15] git commit: [#7432] ticket:598 s/fromtimestamp/utcfromtimestamp & ming session in test

[#7432] ticket:598 s/fromtimestamp/utcfromtimestamp & ming session in test


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

Branch: refs/heads/master
Commit: 99114da6d1d175f7c56ad8fc228040ec34777403
Parents: ec86311
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Jun 5 06:32:02 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Jun 20 15:39:18 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py                       | 4 ++--
 Allura/allura/tests/model/test_auth.py            | 2 +-
 ForgeUserStats/forgeuserstats/tests/test_model.py | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/99114da6/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index a09add6..538a0f7 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -257,7 +257,7 @@ class AuthenticationProvider(object):
         last_updated = self.get_last_password_updated(user)
         if days and now - last_updated > timedelta(days=days):
             return True
-        if before and last_updated < datetime.fromtimestamp(before):
+        if before and last_updated < datetime.utcfromtimestamp(before):
             return True
         return False
 
@@ -347,7 +347,7 @@ class LocalAuthenticationProvider(AuthenticationProvider):
             d = self.user_registration_date(user)
             # _id.generation_time returns aware datetime (in UTC)
             # but we're using naive UTC time everywhere
-            d = datetime.fromtimestamp(calendar.timegm(d.utctimetuple()))
+            d = datetime.utcfromtimestamp(calendar.timegm(d.utctimetuple()))
         return d
 
 

http://git-wip-us.apache.org/repos/asf/allura/blob/99114da6/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 6389002..8816d99 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -91,7 +91,7 @@ class TestLocalAuthenticationProvider(object):
         user._id = ObjectId()
         user.last_password_updated = None
         upd = self.provider.get_last_password_updated(user)
-        gen_time = datetime.fromtimestamp(
+        gen_time = datetime.utcfromtimestamp(
             calendar.timegm(user._id.generation_time.utctimetuple()))
         assert_equal(upd, gen_time)
 

http://git-wip-us.apache.org/repos/asf/allura/blob/99114da6/ForgeUserStats/forgeuserstats/tests/test_model.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_model.py b/ForgeUserStats/forgeuserstats/tests/test_model.py
index 62cb02e..c9a8cf4 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_model.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_model.py
@@ -369,7 +369,8 @@ class TestUserStats(unittest.TestCase):
         topic = TroveCategory.query.get(shortname='scientific')
         commit_time = datetime.utcnow() + timedelta(-1)
 
-        self.user.set_password('testpassword')
+        with mock.patch('allura.lib.plugin.session'):
+            self.user.set_password('testpassword')
         addr = M.EmailAddress.upsert('rcopeland@geek.net')
         self.user.claim_address('rcopeland@geek.net')