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

Commit

Permalink
clean out _feature all over the place
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McKay committed Jun 29, 2011
1 parent c550d56 commit 4057c18
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions apps/api/tests/test_legacy.py
Expand Up @@ -140,9 +140,15 @@ class APITest(TestCase):
'base/addon_5299_gcal']

def setUp(self):
self._new_features = settings.NEW_FEATURES
settings.NEW_FEATURES = False

if hasattr(Addon, '_feature'):
delattr(Addon, '_feature')

def tearDown(self):
settings.NEW_FEATURES = self._new_features

def test_api_caching(self):
response = self.client.get('/en-US/firefox/api/1.5/addon/3615')
eq_(response.status_code, 200)
Expand Down Expand Up @@ -412,7 +418,8 @@ def test_is_category_featured(self):
('en-US', 'firefox', 0),
('ja', 'seamonkey', 0)]:
# Clean out the special cache for feature.
delattr(Addon, '_feature')
if hasattr(Addon, '_feature'):
delattr(Addon, '_feature')
self.assertContains(make_call('addon/5299', version=1.5,
lang=lang, app=app),
'<featured>%s</featured>' % result)
Expand All @@ -438,7 +445,16 @@ class ListTest(TestCase):
"""Tests the list view with various urls."""
fixtures = ['base/apps', 'base/addon_3615', 'base/featured']

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def setUp(self):
# TODO(cvan): Remove this once featured collections are enabled.
self._new_features = settings.NEW_FEATURES
settings.NEW_FEATURES = False
if hasattr(Addon, '_feature'):
delattr(Addon, '_feature')

def tearDown(self):
settings.NEW_FEATURES = self._new_features

def test_defaults(self):
"""
This tests the default settings for /list.
Expand All @@ -447,7 +463,6 @@ def test_defaults(self):
response = make_call('list')
self.assertContains(response, '<addon id', 3)

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def test_randomness(self):
"""
This tests that we're sufficiently random when recommending addons.
Expand All @@ -468,7 +483,6 @@ def test_randomness(self):
assert not all_identical, (
"All 100 requests returned the exact same response.")

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def test_type_filter(self):
"""
This tests that list filtering works.
Expand All @@ -477,12 +491,10 @@ def test_type_filter(self):
response = make_call('list/recommended/9/1')
self.assertContains(response, """<type id="9">Persona</type>""", 1)

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def test_persona_search_15(self):
response = make_call('list/recommended/9/1', version=1.5)
self.assertContains(response, """<type id="9">Persona</type>""", 1)

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def test_limits(self):
"""
Assert /list/recommended/all/1 gets one item only.
Expand All @@ -500,7 +512,6 @@ def test_version_filter(self):
response = make_call('list/new/1/1/all/4.0')
self.assertNotContains(response, "<addon id")

@patch.object(settings._wrapped, 'NEW_FEATURES', False)
def test_backfill(self):
"""
The /list/recommended should first populate itself with addons in its
Expand Down

0 comments on commit 4057c18

Please sign in to comment.