From 9a0f227fe3b06632e8e59efa297cdd4398248e02 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Jul 04 2017 14:03:28 +0000 Subject: Don't show '+' sign when GROUP_MNGT is off --- diff --git a/pagure/templates/index_auth.html b/pagure/templates/index_auth.html index 18078e6..d1568fe 100644 --- a/pagure/templates/index_auth.html +++ b/pagure/templates/index_auth.html @@ -186,11 +186,13 @@
My Groups {{ user.groups | length }} - - - + {% if config.get('ENABLE_GROUP_MNGT') %} + + + + {% endif %}
{% for group in user.groups %} diff --git a/tests/test_pagure_flask_ui_groups.py b/tests/test_pagure_flask_ui_groups.py index 07a51d4..36b7994 100644 --- a/tests/test_pagure_flask_ui_groups.py +++ b/tests/test_pagure_flask_ui_groups.py @@ -41,7 +41,6 @@ class PagureFlaskGroupstests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - def test_group_lists(self): """ Test the group_lists endpoint. """ output = self.app.get('/groups') @@ -50,6 +49,27 @@ class PagureFlaskGroupstests(tests.Modeltests): ' Groups 0', output.data) + def test_add_group_index_auth(self): + """ Test the presence of the add group button on the front page. """ + user = tests.FakeUser(username='foo') + with tests.user_set(pagure.APP, user): + output = self.app.get('/') + self.assertEqual(output.status_code, 200) + self.assertIn( + 'title="Create New Group" aria-hidden="true">', + output.data) + + @patch.dict('pagure.APP.config', {'ENABLE_GROUP_MNGT': False}) + def test_not_add_group_index_auth(self): + """ Test the presence of the add group button on the front page. """ + user = tests.FakeUser(username='foo') + with tests.user_set(pagure.APP, user): + output = self.app.get('/') + self.assertEqual(output.status_code, 200) + self.assertNotIn( + 'title="Create New Group" aria-hidden="true">', + output.data) + def test_add_group(self): """ Test the add_group endpoint. """ output = self.app.get('/group/add')