Skip to content

Commit

Permalink
Remove usage of DEF_BRANCH in the feeds module
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Aug 16, 2017
1 parent 47b6477 commit 69fab17
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
9 changes: 4 additions & 5 deletions codespeed/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ def get_context_data(self, **kwargs):


class LatestEntries(ResultFeed):
description = "Last benchmark runs"
description = "Last Results"

def result_filter(self):
return Q(revision__branch__name=settings.DEF_BRANCH)
return Q()


class LatestSignificantEntries(ResultFeed):
description = "Last benchmark runs with significant changes"
description = "Last results with significant changes"

def result_filter(self):
return Q(revision__branch__name=settings.DEF_BRANCH,
colorcode__in=('red', 'green'))
return Q(colorcode__in=('red', 'green'))
3 changes: 3 additions & 0 deletions codespeed/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ def save_result(data):

def create_report_if_enough_data(rev, exe, e):
"""Triggers Report creation when there are enough results"""
if exe.project.track is not True:
return False

last_revs = Revision.objects.filter(
branch=rev.branch
).order_by('-date')[:2]
Expand Down
10 changes: 10 additions & 0 deletions codespeed/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,13 @@ def test_reports_post_returns_405(self):
response = self.client.post(reverse('codespeed.views.reports'), {})

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)
4 changes: 2 additions & 2 deletions codespeed/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^about/$', TemplateView.as_view(template_name='about.html'), name='about'),
# 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(),
name='latest_significant_feeds'),
name='latest-significant-results'),
)

urlpatterns += patterns('codespeed.views',
Expand Down

0 comments on commit 69fab17

Please sign in to comment.