• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revisióne139cf7fcc8d150a1cd1e98d90e93f1f22b3b928 (tree)
Tiempo2012-07-11 11:54:49
AutorDave Brondsema <dbrondsema@geek...>
CommiterDave Brondsema

Log Message

[#4272] add test for search_feed, and make valid rss/atom

Cambiar Resumen

Diferencia incremental

--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -659,6 +659,16 @@ class TestFunctionalController(TrackerTestController):
659659 assert '3 results' in response, response.showbrowser()
660660 assert 'test third ticket' in response, response.showbrowser()
661661
662+ def test_search_feed(self):
663+ self.new_ticket(summary='test first ticket')
664+ ThreadLocalORMSession.flush_all()
665+ M.MonQTask.run_ready()
666+ ThreadLocalORMSession.flush_all()
667+ response = self.app.get('/p/test/bugs/search_feed?q=test')
668+ assert '<title>test first ticket</title>' in response
669+ response = self.app.get('/p/test/bugs/search_feed.atom?q=test')
670+ assert '<title>test first ticket</title>' in response
671+
662672 def test_touch(self):
663673 self.new_ticket(summary='test touch')
664674 h.set_context('test', 'bugs', neighborhood='Projects')
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -332,7 +332,7 @@ class RootController(BaseController):
332332 return dict(bin_counts=bin_counts)
333333
334334 def paged_query(self, q, limit=None, page=0, sort=None, columns=None, **kw):
335- """Query tickets, sorting and paginating the result.
335+ """Query tickets, filtering for 'read' permission, sorting and paginating the result.
336336
337337 We do the sorting and skipping right in SOLR, before we ever ask
338338 Mongo for the actual tickets. Other keywords for
@@ -523,17 +523,18 @@ class RootController(BaseController):
523523 result = self.paged_query(q, page=page, sort=sort, columns=columns, **kw)
524524 response.headers['Content-Type'] = ''
525525 response.content_type = 'application/xml'
526- d = dict(title='Ticket search results', link=c.app.url, description='You searched for %s' % q, language=u'en')
526+ d = dict(title='Ticket search results', link=h.absurl(c.app.url), description='You searched for %s' % q, language=u'en')
527527 if request.environ['PATH_INFO'].endswith('.atom'):
528528 feed = FG.Atom1Feed(**d)
529529 else:
530530 feed = FG.Rss201rev2Feed(**d)
531531 for t in result['tickets']:
532+ url = h.absurl(t.url().encode('utf-8'))
532533 feed.add_item(title=t.summary,
533- link=h.absurl(t.url().encode('utf-8')),
534+ link=url,
534535 pubdate=t.mod_date,
535536 description=t.description,
536- unique_id=str(t._id),
537+ unique_id=url,
537538 author_name=t.reported_by.display_name,
538539 author_link=h.absurl(t.reported_by.url()))
539540 return feed.writeString('utf-8')