allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/4] allura git commit: [#7919] fix some tests
Date Tue, 03 Nov 2015 19:30:53 GMT
Repository: allura
Updated Branches:
  refs/heads/db/7919 e8a55ebeb -> e1ca8deb8


[#7919] fix some tests


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

Branch: refs/heads/db/7919
Commit: 9637c4e6441e1934b26ea351e6a604d7550a2708
Parents: e8a55eb
Author: Dave Brondsema <dave@brondsema.net>
Authored: Mon Nov 2 20:14:32 2015 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Mon Nov 2 20:14:50 2015 -0500

----------------------------------------------------------------------
 .../allura/templates/jinja_master/top_nav.html  |  2 +-
 Allura/allura/tests/functional/test_home.py     | 20 +++++++++++---------
 .../tests/functional/test_neighborhood.py       |  2 +-
 3 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9637c4e6/Allura/allura/templates/jinja_master/top_nav.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/top_nav.html b/Allura/allura/templates/jinja_master/top_nav.html
index 91b7194..85e3056 100644
--- a/Allura/allura/templates/jinja_master/top_nav.html
+++ b/Allura/allura/templates/jinja_master/top_nav.html
@@ -35,7 +35,7 @@
     </li>
   {% endfor %}
   {% if h.has_access(c.project, 'admin')() %}
-    <li id="add-tool-container"><a class="add-tool-toggle">Add New...</a></li>
+    <li id="add-tool-container"><a href='#' class="add-tool-toggle">Add New...</a></li>
     <button id="toggle-admin-btn"><i class="fa fa-lock"></i></button>
   {% endif %}
 </ul>

http://git-wip-us.apache.org/repos/asf/allura/blob/9637c4e6/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 58f1d61..4c25e05 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -19,13 +19,12 @@ import json
 import re
 
 from pylons import tmpl_context as c
+from nose.tools import assert_equal, assert_not_in, assert_in
+from ming.orm import ThreadLocalORMSession
 
 from allura.tests import TestController
 from allura.tests import decorators as td
 from allura import model as M
-from ming.orm import ThreadLocalORMSession
-
-from nose.tools import assert_equal, assert_not_in
 
 
 class TestProjectHome(TestController):
@@ -37,6 +36,7 @@ class TestProjectHome(TestController):
         assert re.search(r'<!-- Server: \S+ -->',
                          str(root.html)), 'Missing Server comment'
         nav_links = root.html.find('div', dict(id='top_nav')).findAll('a')
+        nav_links = [nl for nl in nav_links if nl['class'] != 'add-tool-toggle']
         assert len(nav_links) == len(response.json['menu'])
         for nl, entry in zip(nav_links, response.json['menu']):
             assert nl['href'] == entry['url']
@@ -53,10 +53,10 @@ class TestProjectHome(TestController):
         menu = response.json['menu']
         wikis = menu[-2]['children']
         assert_equal(len(wikis), 2)
-        assert {u'url': u'/p/test/wiki/', u'name': u'Wiki', u'icon':
-                u'tool-wiki', 'tool_name': 'wiki'} in wikis, wikis
-        assert {u'url': u'/p/test/wiki2/', u'name': u'wiki2', u'icon':
-                u'tool-wiki', 'tool_name': 'wiki'} in wikis, wikis
+        assert_in({'url': '/p/test/wiki/', 'name': 'Wiki', 'mount_point': 'wiki',
+                   'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False, 'ordinal':
3}, wikis)
+        assert_in({'url': '/p/test/wiki2/', 'name': 'wiki2', 'mount_point': 'wiki2',
+                   'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False, 'ordinal':
4}, wikis)
 
     def test_sitemap_limit_per_tool(self):
         """Test that sitemap is limited to max of 10 items per tool type."""
@@ -85,8 +85,10 @@ class TestProjectHome(TestController):
         menu = response.json['menu']
         wiki_menu = [m for m in menu if m['tool_name'] == 'wiki'][0]
         assert_equal(len(wiki_menu['children']), 10)
-        assert {u'url': u'/p/test/_list/wiki', u'name': u'More...',
-                u'icon': u'tool-wiki', 'tool_name': 'wiki'} in wiki_menu['children']
+        for child in wiki_menu['children']:
+            child.pop('ordinal')
+        assert_in({'url': '/p/test/_list/wiki', 'name': 'More...', 'mount_point': '_list',
+                   'icon': 'tool-wiki', 'tool_name': 'wiki', 'is_anchored': False}, wiki_menu['children'])
 
     @td.with_wiki
     def test_neighborhood_home(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/9637c4e6/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 7281554..d946c7b 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -714,7 +714,7 @@ class TestNeighborhood(TestController):
             status=302).follow()
         p = M.Project.query.get(shortname='testtemp')
         # make sure the correct tools got installed in the right order
-        top_nav = r.html.find('div', {'id': 'top_nav'})
+        top_nav = r.html.find('div', {'id': 'top_nav'}).contents[1]
         assert top_nav.contents[1].contents[1].contents[1]['href'] == '/adobe/testtemp/wiki/'
         assert 'Wiki' in top_nav.contents[1].contents[1].contents[1].contents[0]
         assert top_nav.contents[1].contents[3].contents[1]['href'] == '/adobe/testtemp/discussion/'


Mime
View raw message