Merge pull request #1229 from vinyll/version_sidebar-729414

memorize last choice in addon firefox version (bug 729414)
This commit is contained in:
Rob Hudson 2013-10-15 11:45:26 -07:00
Родитель 833bdefdae 4a096a7c3c
Коммит a4c2f01cac
2 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -977,6 +977,28 @@ class TestCollectionSearch(SearchBase):
eq_(self.get_results(r), [sm_collection.id])
def test_session_version_sidebar(self):
request = RequestFactory()
request.session = {}
request.APP = amo.FIREFOX
request.get(reverse('search.search'))
facets = {
u'platforms': [{u'count': 58, u'term': 1}],
u'appversions': [{u'count': 58, u'term': 5000000200100}],
u'categories': [{u'count': 55, u'term': 1}],
u'tags': [],
}
versions = version_sidebar(request, {}, facets)
assert not versions[1].selected
versions = version_sidebar(request, {'appver': '5.0'}, facets)
assert versions[1].selected
versions = version_sidebar(request, {}, facets)
assert versions[1].selected
def test_search_redirects():
changes = (
('q=yeah&sort=newest', 'q=yeah&sort=updated'),

Просмотреть файл

@ -533,7 +533,9 @@ def category_sidebar(request, query, facets):
def version_sidebar(request, query, facets):
appver = query.get('appver')
appver = query.get('appver') or request.session.get('search.appver')
if query.get('appver'):
request.session['search.appver'] = appver
app = unicode(request.APP.pretty)
exclude_versions = getattr(request.APP, 'exclude_versions', [])
# L10n: {0} is an application, such as Firefox. This means "any version of