You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/01/10 21:15:28 UTC
git commit: Fix matching urls for grouped tools
Updated Branches:
refs/heads/master c2087a2cc -> 577ebd783
Fix matching urls for grouped tools
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/577ebd78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/577ebd78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/577ebd78
Branch: refs/heads/master
Commit: 577ebd78382a64a156d0662325fca8a2d33e5b7e
Parents: c2087a2
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Jan 10 20:14:56 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 10 20:14:56 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/project.py | 8 ++++++--
Allura/allura/tests/unit/test_project.py | 12 ++++++++----
2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/577ebd78/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 84f346d..2f73ebb 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -458,11 +458,15 @@ class Project(MappedClass, ActivityNode, ActivityObject):
if tool_name not in grouped_nav:
# change label to be the tool name (type)
e.label = tool_name.capitalize()
+ # add tool url to list of urls that will match this nav entry
+ # have to do this before changing the url to the list page
+ e.matching_urls.append(e.url)
# change url to point to tool list page
e.url = self.url() + '_list/' + tool_name
grouped_nav[tool_name] = e
- # add tool url to list of urls that will match this nav entry
- grouped_nav[tool_name].matching_urls.append(e.url)
+ else:
+ # add tool url to list of urls that will match this nav entry
+ grouped_nav[tool_name].matching_urls.append(e.url)
return grouped_nav.values()
def parent_iter(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/577ebd78/Allura/allura/tests/unit/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_project.py b/Allura/allura/tests/unit/test_project.py
index f33c592..a661e7e 100644
--- a/Allura/allura/tests/unit/test_project.py
+++ b/Allura/allura/tests/unit/test_project.py
@@ -19,15 +19,17 @@ class TestProject(unittest.TestCase):
]
p.url = Mock(return_value='proj_url/')
p.sitemap = Mock(return_value=sitemap_entries)
+ entries = p.grouped_navbar_entries()
expected = [
('Tickets', 'proj_url/_list/tickets', 3),
('wiki', 'wiki url', 0),
('Discussion', 'proj_url/_list/discussion', 2),
('subproject', 'subproject url', 0),
]
- actual = [(e.label, e.url, len(e.matching_urls))
- for e in p.grouped_navbar_entries()]
+ expected_ticket_urls = ['bugs url', 'features url', 'support url']
+ actual = [(e.label, e.url, len(e.matching_urls)) for e in entries]
self.assertEqual(expected, actual)
+ self.assertEqual(entries[0].matching_urls, expected_ticket_urls)
def test_grouped_navbar_threshold(self):
p = M.Project()
@@ -43,6 +45,7 @@ class TestProject(unittest.TestCase):
p.url = Mock(return_value='proj_url/')
p.sitemap = Mock(return_value=sitemap_entries)
p.tool_data['allura'] = {'grouping_threshold': 2}
+ entries = p.grouped_navbar_entries()
expected = [
('Tickets', 'proj_url/_list/tickets', 3),
('wiki', 'wiki url', 0),
@@ -50,6 +53,7 @@ class TestProject(unittest.TestCase):
('subproject', 'subproject url', 0),
('help', 'help url', 0),
]
- actual = [(e.label, e.url, len(e.matching_urls))
- for e in p.grouped_navbar_entries()]
+ expected_ticket_urls = ['bugs url', 'features url', 'support url']
+ actual = [(e.label, e.url, len(e.matching_urls)) for e in entries]
self.assertEqual(expected, actual)
+ self.assertEqual(entries[0].matching_urls, expected_ticket_urls)