You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/01/09 17:29:05 UTC
allura git commit: [#7516] ticket:706 Don't depend on timing in test
Repository: allura
Updated Branches:
refs/heads/ib/7516 [created] 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/ib/7516
Commit: c78c0a1ba93f9b09497e648e45537fa130099fc8
Parents: 6205700
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jan 9 15:21:37 2015 +0000
Committer: Igor Bondarenko <je...@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()