allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/4] allura git commit: [#7816] ticket:713 Fix/add tests
Date Thu, 15 Jan 2015 18:29:39 GMT
[#7816] ticket:713 Fix/add tests


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

Branch: refs/heads/master
Commit: 4a5275c7957212f94d25715a7a50dbb4141f8ba0
Parents: 24ddf59
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Jan 14 11:46:25 2015 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Wed Jan 14 11:46:25 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_site_admin.py |  5 +++--
 Allura/allura/tests/test_helpers.py               | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4a5275c7/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 6c327c7..be89354 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -229,6 +229,7 @@ class TestUsersSearch(TestController):
     TEST_HIT = MagicMock(hits=1, docs=[{
         '_version_': 1478773871277506560,
         'disabled_b': False,
+        'pending_b': False,
         'display_name_t': 'Darth Vader',
         'id': 'allura/model/auth/User#540efdf2100d2b1483155d39',
         'last_access_login_date_dt': '2014-09-09T13:17:40.176Z',
@@ -263,7 +264,7 @@ class TestUsersSearch(TestController):
         assert_equal(options, ['username', 'display_name', '__custom__'])
         ths = [th.text for th in r.html.findAll('th')]
         assert_equal(ths, ['Username', 'Display name', 'Email', 'Registered',
-                           'Disabled?', 'Details'])
+                           'Status', 'Details'])
 
     @patch('allura.controllers.site_admin.search')
     def test_additional_fields(self, search):
@@ -275,7 +276,7 @@ class TestUsersSearch(TestController):
         assert_equal(options, ['username', 'display_name', 'email_addresses', 'url', '__custom__'])
         ths = [th.text for th in r.html.findAll('th')]
         assert_equal(ths, ['Username', 'Display name', 'Email', 'Registered',
-                           'Disabled?', 'url', 'Details'])
+                           'Status', 'url', 'Details'])
 
 
 class TestUserDetails(TestController):

http://git-wip-us.apache.org/repos/asf/allura/blob/4a5275c7/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 4cced7e..780f21c 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -549,3 +549,18 @@ class TestIterEntryPoints(TestCase):
                                 'Ambiguous \[allura\] entry points detected. '
                                 'Multiple entry points with name "myapp".',
                                 list, h.iter_entry_points('allura'))
+
+def test_get_user_status():
+    user = {'pending': False, 'disabled': False}
+    assert_equals(h.get_user_status(user), 'enabled')
+
+    user = {'pending': True, 'disabled': True}
+    assert_equals(h.get_user_status(user), 'disabled')
+    user = {'pending': False, 'disabled': True}
+    assert_equals(h.get_user_status(user), 'disabled')
+
+    user = {'pending': True, 'disabled': False}
+    assert_equals(h.get_user_status(user), 'pending')
+
+    user = M.User.by_username('test-admin')
+    assert_equals(h.get_user_status(user), 'enabled')


Mime
View raw message