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 2022/03/08 22:39:09 UTC
[allura] 02/03: [#8391] Unsubscribe from a project when a user is removed from Admin group - added a test case
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 438459b6cd68f02b0c33def285899df7c5627be2
Author: Vrinda A <vr...@in.bosch.com>
AuthorDate: Fri Feb 25 17:12:53 2022 +0530
[#8391] Unsubscribe from a project when a user is removed from Admin group - added a test case
---
Allura/allura/tests/functional/test_admin.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 8ab03d1..1dbe6d1 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -666,6 +666,30 @@ class TestProjectAdmin(TestController):
user_id=uid, project_id=p._id, app_config_id=ac._id)
assert sub, 'New admin not subscribed to app %s' % ac
+ def test_admin_unsubscriptions(self):
+ """
+ When user is removed from admins group then user must be unsubscribed
+ from all the tools in the project
+ """
+ r = self.app.get('/admin/groups/')
+ admin_holder = r.html.find(
+ 'table', {'id': 'usergroup_admin'}).findAll('tr')[1]
+ admin_id = admin_holder['data-group']
+ with audits('add user test-user to Admin'):
+ self.app.post('/admin/groups/add_user', params={
+ 'role_id': admin_id,
+ 'username': 'test-user'})
+ p_nbhd = M.Neighborhood.query.get(name='Projects')
+ p = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
+ uid = M.User.by_username('test-user')._id
+ for ac in p.app_configs:
+ M.Mailbox.unsubscribe(
+ user_id=uid, project_id=p._id, app_config_id=ac._id
+ )
+ sub = M.Mailbox.subscribed(
+ user_id=uid, project_id=p._id, app_config_id=ac._id)
+ assert not sub, 'New admin not unsubscribed to app %s' % ac
+
def test_new_user_subscriptions(self):
"""Newly added user must not be subscribed to all the tools in the project if he is not admin"""
r = self.app.get('/admin/groups/')