patch settings > settings._wrapped (bug 547096)
This commit is contained in:
Родитель
0f274ba033
Коммит
a4693386e9
|
@ -42,13 +42,13 @@ class TestAddonManager(test_utils.TestCase):
|
|||
def setUp(self):
|
||||
set_user(None)
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_featured(self):
|
||||
featured = Addon.objects.featured(amo.FIREFOX)[0]
|
||||
eq_(featured.id, 1)
|
||||
eq_(Addon.objects.featured(amo.FIREFOX).count(), 5)
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', True)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_featured(self):
|
||||
featured = Addon.objects.featured(amo.FIREFOX)[0]
|
||||
eq_(featured.id, 1001)
|
||||
|
@ -122,7 +122,7 @@ class TestAddonManagerFeatured(test_utils.TestCase):
|
|||
fixtures = ['addons/featured', 'bandwagon/featured_collections',
|
||||
'base/collections', 'base/featured']
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', True)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_new_featured(self):
|
||||
f = Addon.objects.featured(amo.FIREFOX)
|
||||
eq_(f.count(), 6)
|
||||
|
@ -205,7 +205,7 @@ class TestAddonModels(test_utils.TestCase):
|
|||
a = Addon.objects.get(pk=5299)
|
||||
eq_(a.current_beta_version.id, 50000)
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_current_version_mixed_statuses(self):
|
||||
"""Mixed file statuses are evil (bug 558237)."""
|
||||
a = Addon.objects.get(pk=3895)
|
||||
|
@ -355,14 +355,14 @@ class TestAddonModels(test_utils.TestCase):
|
|||
a.status = amo.STATUS_LISTED
|
||||
assert a.is_selfhosted(), 'listed add-on => is_selfhosted()'
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_is_featured(self):
|
||||
"""Test if an add-on is globally featured"""
|
||||
a = Addon.objects.get(pk=1003)
|
||||
assert a.is_featured(amo.FIREFOX, 'en-US'), (
|
||||
'globally featured add-on not recognized')
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_is_category_featured(self):
|
||||
"""Test if an add-on is category featured"""
|
||||
Feature.objects.filter(addon=1001).delete()
|
||||
|
@ -1093,11 +1093,11 @@ class TestAddonModelsFeatured(test_utils.TestCase):
|
|||
f = Addon.featured_random(amo.SUNBIRD, 'en-US')
|
||||
eq_(f, [])
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_featured_random(self):
|
||||
self._test_featured_random()
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', True)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_new_featured_random(self):
|
||||
self._test_featured_random()
|
||||
|
||||
|
|
|
@ -1268,11 +1268,11 @@ class TestMobileHome(TestMobile):
|
|||
[a.id for a in sorted(popular, key=lambda x: x.average_daily_users,
|
||||
reverse=True)])
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', False)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_addons(self):
|
||||
self._test_addons()
|
||||
|
||||
@patch.object(settings, 'NEW_FEATURES', True)
|
||||
@patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_new_addons(self):
|
||||
self._test_addons()
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@ class TestFeaturedPage(test_utils.TestCase):
|
|||
if hasattr(Addon, '_feature'):
|
||||
del Addon._feature
|
||||
|
||||
@mock.patch.object(settings, 'NEW_FEATURES', False)
|
||||
@mock.patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_featured_addons(self):
|
||||
"""Make sure that only featured add-ons are shown."""
|
||||
# Persona returned by featured.
|
||||
|
|
|
@ -184,7 +184,7 @@ class TestValidateFile(BaseUploadTest):
|
|||
doc = pq(r.content)
|
||||
assert doc('time').text()
|
||||
|
||||
@mock.patch.object(settings, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
@mock.patch.object(settings._wrapped, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
@mock.patch('devhub.tasks.run_validator')
|
||||
def test_validator_errors(self, v):
|
||||
v.side_effect = ValueError('catastrophic failure in amo-validator')
|
||||
|
@ -255,7 +255,7 @@ class TestValidateFile(BaseUploadTest):
|
|||
doc = pq(data['validation']['messages'][0]['description'][0])
|
||||
eq_(doc('a').text(), 'https://bugzilla.mozilla.org/')
|
||||
|
||||
@mock.patch.object(settings, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
@mock.patch.object(settings._wrapped, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
@mock.patch('devhub.tasks.run_validator')
|
||||
def test_hide_validation_traceback(self, run_validator):
|
||||
run_validator.side_effect = RuntimeError('simulated task error')
|
||||
|
@ -336,7 +336,7 @@ class TestCompatibilityResults(test_utils.TestCase):
|
|||
assert doc('time').text()
|
||||
eq_(doc('table tr td:eq(1)').text(), 'Firefox 4.0.*')
|
||||
|
||||
@mock.patch.object(settings, 'EXPOSE_VALIDATOR_TRACEBACKS', True)
|
||||
@mock.patch.object(settings._wrapped, 'EXPOSE_VALIDATOR_TRACEBACKS', True)
|
||||
def test_validation_error(self):
|
||||
try:
|
||||
raise RuntimeError('simulated task error')
|
||||
|
@ -347,7 +347,7 @@ class TestCompatibilityResults(test_utils.TestCase):
|
|||
eq_(data['validation'], '')
|
||||
eq_(data['error'], error)
|
||||
|
||||
@mock.patch.object(settings, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
@mock.patch.object(settings._wrapped, 'EXPOSE_VALIDATOR_TRACEBACKS', False)
|
||||
def test_hide_validation_traceback(self):
|
||||
try:
|
||||
raise RuntimeError('simulated task error')
|
||||
|
|
|
@ -288,11 +288,11 @@ class TestPane(test_utils.TestCase):
|
|||
eq_(li.find('h3.vtruncate').text(), unicode(addon.name))
|
||||
eq_(li.find('img').attr('src'), addon.icon_url)
|
||||
|
||||
@mock.patch.object(settings, 'NEW_FEATURES', False)
|
||||
@mock.patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_featured_addons(self):
|
||||
self._test_featured_addons()
|
||||
|
||||
@mock.patch.object(settings, 'NEW_FEATURES', True)
|
||||
@mock.patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_new_featured_addons(self):
|
||||
self._test_featured_addons()
|
||||
|
||||
|
@ -313,11 +313,11 @@ class TestPane(test_utils.TestCase):
|
|||
eq_(a.attr('target'), '_self')
|
||||
eq_(p.find('.addon-title').text(), unicode(addon.name))
|
||||
|
||||
@mock.patch.object(settings, 'NEW_FEATURES', False)
|
||||
@mock.patch.object(settings._wrapped, 'NEW_FEATURES', False)
|
||||
def test_featured_personas(self):
|
||||
self._test_featured_personas()
|
||||
|
||||
@mock.patch.object(settings, 'NEW_FEATURES', True)
|
||||
@mock.patch.object(settings._wrapped, 'NEW_FEATURES', True)
|
||||
def test_featured_personas(self):
|
||||
self._test_featured_personas()
|
||||
|
||||
|
|
|
@ -1335,7 +1335,7 @@ class TestReview(ReviewBase):
|
|||
response = self.client.get(self.url)
|
||||
eq_(response.status_code, 302)
|
||||
|
||||
@patch.object(settings, 'DEBUG', False)
|
||||
@patch.object(settings._wrapped, 'DEBUG', False)
|
||||
def test_not_author(self):
|
||||
AddonUser.objects.create(addon=self.addon, user=self.editor)
|
||||
response = self.client.get(self.url)
|
||||
|
|
Загрузка…
Ссылка в новой задаче