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/05/17 00:30:35 UTC
[44/50] [abbrv] 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/db/6208
Commit: e7b5be4cb352aec3c57dcc11c92ae5cd5863a9c5
Parents: 3e45f5d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 13:53:02 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
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/')