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 2014/09/22 12:28:02 UTC

[21/31] git commit: [#7657] ticket:651 Fix random password test

[#7657] ticket:651 Fix random password test

It also made other tests hang, but can be fixed more easily


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

Branch: refs/heads/je/42cc_7657b
Commit: 6c9e1eaf3b7cf6105965e2ed5264dc096064bfdf
Parents: 35f19ea
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Sep 17 12:13:26 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Sep 22 11:14:57 2014 +0300

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_site_admin.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/6c9e1eaf/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index a760dc0..4ed7b15 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -20,7 +20,7 @@ import json
 import datetime as dt
 
 from mock import patch, MagicMock
-from nose.tools import assert_equal, assert_not_equal, assert_in, assert_not_in
+from nose.tools import assert_equal, assert_in, assert_not_in
 from ming.odm import ThreadLocalORMSession
 from pylons import tmpl_context as c
 from tg import config
@@ -31,6 +31,7 @@ from allura.tests import TestController
 from allura.tests import decorators as td
 from allura.lib import helpers as h
 from allura.lib.decorators import task
+from allura.lib.plugin import LocalAuthenticationProvider
 
 
 class TestSiteAdmin(TestController):
@@ -446,13 +447,12 @@ class TestUserDetails(TestController):
         # test@example.com set as primary since test2@example.com is deleted
         assert_equal(user.get_pref('email_address'), 'test@example.com')
 
-    def test_set_random_password(self):
-        old_pwd = M.User.by_username('test-user').password
+    @patch.object(LocalAuthenticationProvider, 'set_password')
+    def test_set_random_password(self, set_password):
         with td.audits('Set random password by test-admin', user=True):
             r = self.app.post('/nf/admin/user/set_random_password', params={'username': 'test-user'})
         assert_in('Password is set', self.webflash(r))
-        new_pwd = M.User.by_username('test-user').password
-        assert_not_equal(old_pwd, new_pwd)
+        set_password.assert_called_once()
 
     @patch('allura.tasks.mail_tasks.sendsimplemail')
     @patch('allura.lib.helpers.gen_message_id')