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/08/03 13:30:21 UTC

[6/7] allura git commit: [#7922] ticket:826 Add tests for sitebar admin menu

[#7922] ticket:826 Add tests for sitebar admin menu


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

Branch: refs/heads/ib/7922
Commit: 015ebd03eceef8d21cb4cb23c144bc3ddbc31c51
Parents: 6241e7d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Aug 3 13:37:56 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Aug 3 13:37:56 2015 +0300

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/functional/test_root.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/015ebd03/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 276c4b9..e2604bc 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -819,3 +819,20 @@ class TestRootController(TestController):
                 'Page creation rate limit exceeded. Please try again later.')
             p = model.Page.query.get(title='page2')
             assert_equal(p, None)
+
+    def test_sidebar_admin_menu(self):
+        r = self.app.get('/p/test/wiki/Home/')
+        menu = r.html.find('div', {'id': 'sidebar-admin-menu'})
+        menu = [li.find('span').getText() for li in menu.findAll('li')]
+        assert_equal(
+            menu,
+            ['Admin', 'Set Home', 'Permissions', 'Options', 'Label', 'Delete'])
+
+    def test_sidebar_admin_menu_invisible_to_not_admin(self):
+        def assert_invisible_for(username):
+            env = {'username': username}
+            r = self.app.get('/p/test/wiki/Home/', extra_environ=env)
+            menu = r.html.find('div', {'id': 'sidebar-admin-menu'})
+            assert_equal(menu, None)
+        assert_invisible_for('*anonymous')
+        assert_invisible_for('test-user')