Commit 69fab17e authored by Miquel Torres's avatar Miquel Torres
Browse files

Remove usage of DEF_BRANCH in the feeds module

parent 47b6477a
...@@ -35,15 +35,14 @@ class ResultFeed(Feed): ...@@ -35,15 +35,14 @@ class ResultFeed(Feed):
class LatestEntries(ResultFeed): class LatestEntries(ResultFeed):
description = "Last benchmark runs" description = "Last Results"
def result_filter(self): def result_filter(self):
return Q(revision__branch__name=settings.DEF_BRANCH) return Q()
class LatestSignificantEntries(ResultFeed): class LatestSignificantEntries(ResultFeed):
description = "Last benchmark runs with significant changes" description = "Last results with significant changes"
def result_filter(self): def result_filter(self):
return Q(revision__branch__name=settings.DEF_BRANCH, return Q(colorcode__in=('red', 'green'))
colorcode__in=('red', 'green'))
...@@ -134,6 +134,9 @@ def save_result(data): ...@@ -134,6 +134,9 @@ def save_result(data):
def create_report_if_enough_data(rev, exe, e): def create_report_if_enough_data(rev, exe, e):
"""Triggers Report creation when there are enough results""" """Triggers Report creation when there are enough results"""
if exe.project.track is not True:
return False
last_revs = Revision.objects.filter( last_revs = Revision.objects.filter(
branch=rev.branch branch=rev.branch
).order_by('-date')[:2] ).order_by('-date')[:2]
......
...@@ -403,3 +403,13 @@ class TestReports(TestCase): ...@@ -403,3 +403,13 @@ class TestReports(TestCase):
response = self.client.post(reverse('codespeed.views.reports'), {}) response = self.client.post(reverse('codespeed.views.reports'), {})
self.assertEqual(response.status_code, 405) self.assertEqual(response.status_code, 405)
class TestFeeds(TestCase):
def test_latest_result_feed(self):
response = self.client.get(reverse('latest-results'))
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn('<atom:link ', content)
...@@ -9,9 +9,9 @@ urlpatterns = patterns('', ...@@ -9,9 +9,9 @@ urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'), url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'), url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'),
# RSS for reports # RSS for reports
url(r'^feeds/latest/$', LatestEntries(), name='latest_feeds'), url(r'^feeds/latest/$', LatestEntries(), name='latest-results'),
url(r'^feeds/latest_significant/$', LatestSignificantEntries(), url(r'^feeds/latest_significant/$', LatestSignificantEntries(),
name='latest_significant_feeds'), name='latest-significant-results'),
) )
urlpatterns += patterns('codespeed.views', urlpatterns += patterns('codespeed.views',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment