Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Fixed a bad redirect in compat (bug 787258)
Browse files Browse the repository at this point in the history
  • Loading branch information
robhudson authored and cvan committed Aug 31, 2012
1 parent 3bea3e9 commit 321e4da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions apps/compat/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
}


class TestIndex(amo.tests.TestCase):

# TODO: Test valid version processing here.

def test_no_version_redirect(self):
res = self.client.get(reverse('compat.index'))
self.assert3xx(res, reverse('compat.index',
args=[settings.COMPAT[0]['main']]))


class TestIncoming(amo.tests.TestCase):

def setUp(self):
Expand Down
5 changes: 2 additions & 3 deletions apps/compat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.views.decorators.csrf import csrf_exempt

import jingo
import redisutils
from tower import ugettext as _

import amo.utils
Expand All @@ -29,7 +28,8 @@ def index(request, version=None):
if not COMPAT:
return jingo.render(request, template, {'results': False})
if version not in compat_dict:
return http.HttpResponseRedirect('compat.index', COMPAT[0]['main'])
return http.HttpResponseRedirect(reverse('compat.index',
args=[COMPAT[0]['main']]))
qs = AppCompat.search()
binary = None

Expand Down Expand Up @@ -92,7 +92,6 @@ def version_compat(qs, compat, app, binary):

def usage_stats(request, compat, app, binary=None):
# Get the list of add-ons for usage stats.
redis = redisutils.connections['master']
qs = AppCompat.search().order_by('-usage.%s' % app).values_dict()
if request.GET.get('previous'):
qs = qs.filter(**{
Expand Down

0 comments on commit 321e4da

Please sign in to comment.