allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#7516] ticket:706 Don't depend on timing in test
Date Fri, 09 Jan 2015 17:35:34 GMT
Repository: allura
Updated Branches:
  refs/heads/master 6205700f3 -> c78c0a1ba


[#7516] ticket:706 Don't depend on timing in test


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

Branch: refs/heads/master
Commit: c78c0a1ba93f9b09497e648e45537fa130099fc8
Parents: 6205700
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Jan 9 15:21:37 2015 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Fri Jan 9 15:21:37 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tests/unit/test_ldap_auth_provider.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c78c0a1b/Allura/allura/tests/unit/test_ldap_auth_provider.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index 417f200..1dc4bf3 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -127,15 +127,13 @@ class TestLdapAuthenticationProvider(object):
         connection.unbind_s.assert_called_once()
 
     @patch('allura.lib.plugin.ldap')
-    def test_set_password_sets_last_updated(self, ldap):
+    @patch('allura.lib.plugin.datetime', autospec=True)
+    def test_set_password_sets_last_updated(self, dt_mock, ldap):
         user = Mock()
         user.__ming__ = Mock()
         user.last_password_updated = None
-        now1 = datetime.utcnow()
         self.provider.set_password(user, None, 'new')
-        now2 = datetime.utcnow()
-        assert_true(user.last_password_updated > now1)
-        assert_true(user.last_password_updated < now2)
+        assert_equal(user.last_password_updated, dt_mock.utcnow.return_value)
 
     def test_get_last_password_updated_not_set(self):
         user = Mock()


Mime
View raw message