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 2013/01/31 17:47:19 UTC
[5/5] git commit: [#4943] test for top nav,
include newly installed tools on first pageload
Updated Branches:
refs/heads/db/4943 [created] 2d5ad1add
[#4943] test for top nav, include newly installed tools on first pageload
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2d5ad1ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2d5ad1ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2d5ad1ad
Branch: refs/heads/db/4943
Commit: 2d5ad1add473acce28cc49274b42f86827bb1cd6
Parents: 1595ebb
Author: Dave Brondsema <db...@geek.net>
Authored: Thu Jan 31 16:34:53 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Thu Jan 31 16:34:53 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/project.py | 8 +++++---
.../allura/tests/functional/test_neighborhood.py | 5 +++++
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d5ad1ad/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index f12673f..df6fdc9 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -393,7 +393,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
anchored_tools =self.neighborhood.get_anchored_tools()
i = len(anchored_tools)
- self.install_anchored_tools()
+ new_tools = self.install_anchored_tools()
# Set menu mode
delta_ordinal = i
@@ -409,7 +409,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
if ordinal > max_ordinal:
max_ordinal = ordinal
entries.append({'ordinal':sub.ordinal + delta_ordinal,'entry':SitemapEntry(sub.name, sub.url())})
- for ac in self.app_configs:
+ for ac in self.app_configs + [a.config for a in new_tools]:
if excluded_tools and ac.tool_name in excluded_tools:
continue
# Tool could've been uninstalled in the meantime
@@ -444,14 +444,16 @@ class Project(MappedClass, ActivityNode, ActivityObject):
anchored_tools = self.neighborhood.get_anchored_tools()
installed_tools = [tool.tool_name.lower() for tool in self.app_configs]
i = 0
+ new_tools = []
if not self.is_nbhd_project:
for tool, label in anchored_tools.iteritems():
if tool not in installed_tools:
try:
- self.install_app(tool, tool, label, i)
+ new_tools.append(self.install_app(tool, tool, label, i))
except Exception:
log.error('%s is not available' % tool, exc_info=True)
i += 1
+ return new_tools
def grouped_navbar_entries(self):
"""Return a ``allura.app.SitemapEntry`` list suitable for rendering
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d5ad1ad/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 0c02e06..9a1738a 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -132,6 +132,11 @@ class TestNeighborhood(TestController):
assert 'error' in self.webflash(r)
assert_equal(neighborhood.anchored_tools, 'wiki:Wiki, tickets:Ticket')
+ r = self.app.get('/p/test/admin/overview')
+ top_nav = r.html.find(id='top_nav')
+ assert top_nav.find(href='/p/test/wiki/'), top_nav
+ assert top_nav.find(href='/p/test/tickets/'), top_nav
+
r = self.app.get('/p/test/admin/tools')
assert '<div class="fleft isnt_sorted">' in r
delete_tool = r.html.find('a', {'class':'mount_delete'})