Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A5B6CD3DA for ; Wed, 15 May 2013 19:27:31 +0000 (UTC) Received: (qmail 141 invoked by uid 500); 15 May 2013 19:27:31 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 99991 invoked by uid 500); 15 May 2013 19:27:31 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 99923 invoked by uid 99); 15 May 2013 19:27:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 May 2013 19:27:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 19A53B3AF; Wed, 15 May 2013 19:27:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org Date: Wed, 15 May 2013 19:27:32 -0000 Message-Id: <3ddc2e1fa33b4a71ac55692cd3b15f90@git.apache.org> In-Reply-To: <5921dd6ea6c041e0900cb819188bb897@git.apache.org> References: <5921dd6ea6c041e0900cb819188bb897@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/5] git commit: [#5644] ticket:332 Fixes for svn feed [#5644] ticket:332 Fixes for svn feed Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e7b5be4c Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e7b5be4c Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e7b5be4c Branch: refs/heads/master Commit: e7b5be4cb352aec3c57dcc11c92ae5cd5863a9c5 Parents: 3e45f5d Author: Igor Bondarenko Authored: Fri May 10 13:53:02 2013 +0000 Committer: Dave Brondsema Committed: Wed May 15 19:23:48 2013 +0000 ---------------------------------------------------------------------- ForgeSVN/forgesvn/controllers.py | 9 ++++- .../forgesvn/tests/functional/test_controllers.py | 28 +++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7b5be4c/ForgeSVN/forgesvn/controllers.py ---------------------------------------------------------------------- diff --git a/ForgeSVN/forgesvn/controllers.py b/ForgeSVN/forgesvn/controllers.py index 66709f0..1706483 100644 --- a/ForgeSVN/forgesvn/controllers.py +++ b/ForgeSVN/forgesvn/controllers.py @@ -20,7 +20,7 @@ from tg.decorators import with_trailing_slash from pylons import tmpl_context as c from allura.controllers import repository -from allura.controllers.feed import FeedController +from allura.controllers.feed import FeedController, FeedArgs class BranchBrowser(repository.BranchBrowser, FeedController): @@ -28,6 +28,13 @@ class BranchBrowser(repository.BranchBrowser, FeedController): def __init__(self): super(BranchBrowser, self).__init__(None) + def get_feed(self, project, app, user): + query = dict(project_id=project._id, app_config_id=app.config._id) + pname, repo = (project.shortname, app.config.options.mount_label) + title = '%s %s changes' % (pname, repo) + description = 'Recent changes to %s repository in %s project' % (repo, pname) + return FeedArgs(query, title, app.url, description=description) + @expose('jinja:forgesvn:templates/svn/index.html') @with_trailing_slash def index(self, limit=None, page=0, count=0, **kw): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7b5be4c/ForgeSVN/forgesvn/tests/functional/test_controllers.py ---------------------------------------------------------------------- diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py index 9ab3b57..46a42e3 100644 --- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py +++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py @@ -20,6 +20,7 @@ import json import pkg_resources from pylons import tmpl_context as c from ming.orm import ThreadLocalORMSession +from nose.tools import assert_equal from allura import model as M from allura.lib import helpers as h @@ -90,8 +91,31 @@ class TestRootController(SVNTestController): assert val['message'] == 'Create readme' def test_feed(self): - for ext in ['', '.rss', '.atom']: - assert 'Remove hello.txt' in self.app.get('/src/feed%s' % ext) + for ext in ['', '.rss']: + r = self.app.get('/src/feed%s' % ext) + channel = r.xml.find('channel') + title = channel.find('title').text + assert_equal(title, 'test SVN changes') + description = channel.find('description').text + assert_equal(description, 'Recent changes to SVN repository in test project') + link = channel.find('link').text + assert_equal(link, 'http://localhost:80/p/test/src/') + commit = channel.find('item') + assert_equal(commit.find('title').text, 'Create readme') + link = 'http://localhost:80/p/test/src/1/' + assert_equal(commit.find('link').text, link) + assert_equal(commit.find('guid').text, link) + # .atom has slightly different structure + prefix = '{http://www.w3.org/2005/Atom}' + r = self.app.get('/src/feed.atom') + title = r.xml.find(prefix + 'title').text + assert_equal(title, 'test SVN changes') + link = r.xml.find(prefix + 'link').attrib['href'] + assert_equal(link, 'http://localhost:80/p/test/src/') + commit = r.xml.find(prefix + 'entry') + assert_equal(commit.find(prefix + 'title').text, 'Create readme') + link = 'http://localhost:80/p/test/src/1/' + assert_equal(commit.find(prefix + 'link').attrib['href'], link) def test_commit(self): resp = self.app.get('/src/3/tree/')