all testcases should inherit from BaseTestCase, setUp should call super

This commit is contained in:
Mathieu Agopian 2014-11-18 15:56:31 +01:00
Родитель 8c0e08305c
Коммит 276e670b11
82 изменённых файлов: 264 добавлений и 34 удалений

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

@ -79,6 +79,7 @@ class TestHasPerm(TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestHasPerm, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
self.user = UserProfile.objects.get(email='del@icio.us')
self.addon = Addon.objects.get(id=3615)
@ -201,6 +202,7 @@ class TestCheckReviewer(TestCase):
fixtures = ['base/addon_3615', 'addons/persona']
def setUp(self):
super(TestCheckReviewer, self).setUp()
self.user = UserProfile.objects.get()
self.persona = Addon.objects.get(pk=15663)
self.addon = Addon.objects.get(pk=3615)

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

@ -23,6 +23,7 @@ def setup():
class ButtonTest(amo.tests.TestCase):
def setUp(self):
super(ButtonTest, self).setUp()
self.addon = Mock()
self.addon.is_featured.return_value = False
self.addon.is_unreviewed.return_value = False

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

@ -117,6 +117,7 @@ class TestHideDisabledFiles(amo.tests.TestCase):
msg = 'Moving disabled file: %s => %s'
def setUp(self):
super(TestHideDisabledFiles, self).setUp()
p = amo.PLATFORM_ALL.id
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
self.version = Version.objects.create(addon=self.addon)

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

@ -11,6 +11,7 @@ from addons.models import Addon
class TestAddonView(amo.tests.TestCase):
def setUp(self):
super(TestAddonView, self).setUp()
self.addon = Addon.objects.create(slug='x', type=1)
self.func = mock.Mock()
self.func.return_value = mock.sentinel.OK

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

@ -89,6 +89,7 @@ class TestTagsForm(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestTagsForm, self).setUp()
self.addon = Addon.objects.get(pk=3615)
category = Category.objects.get(pk=22)
category.name = 'test'
@ -215,6 +216,7 @@ class TestIconForm(amo.tests.TestCase):
# TODO: AddonFormMedia save() method could do with cleaning up
# so this isn't necessary
def setUp(self):
super(TestIconForm, self).setUp()
self.temp_dir = tempfile.mkdtemp()
self.addon = Addon.objects.get(pk=3615)
@ -227,6 +229,7 @@ class TestIconForm(amo.tests.TestCase):
def tearDown(self):
rm_local_tmp_dir(self.temp_dir)
super(TestIconForm, self).tearDown()
def get_icon_paths(self):
path = os.path.join(self.addon.get_icon_dir(), str(self.addon.id))

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

@ -126,6 +126,7 @@ class TestPerformanceNote(amo.tests.TestCase):
not_listing = '<div class="notification performance-note">'
def setUp(self):
super(TestPerformanceNote, self).setUp()
request_mock = Mock()
request_mock.APP = amo.FIREFOX
self.ctx = {'request': request_mock, 'amo': amo}

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

@ -186,6 +186,7 @@ class TestAddonManager(amo.tests.TestCase):
'bandwagon/featured_collections', 'base/addon_5299_gcal']
def setUp(self):
super(TestAddonManager, self).setUp()
set_user(None)
def test_featured(self):
@ -314,6 +315,7 @@ class TestAddonModels(amo.tests.TestCase):
'bandwagon/featured_collections']
def setUp(self):
super(TestAddonModels, self).setUp()
TranslationSequence.objects.create(id=99243)
# TODO(andym): use Mock appropriately here.
self.old_version = amo.FIREFOX.latest_version
@ -321,6 +323,7 @@ class TestAddonModels(amo.tests.TestCase):
def tearDown(self):
amo.FIREFOX.latest_version = self.old_version
super(TestAddonModels, self).tearDown()
def test_current_version(self):
"""
@ -1498,6 +1501,7 @@ class TestGetVersion(amo.tests.TestCase):
fixtures = ['base/addon_3615', ]
def setUp(self):
super(TestGetVersion, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
@ -1575,6 +1579,7 @@ class TestAddonModelsFeatured(amo.tests.TestCase):
'base/addon_3615', 'base/collections', 'base/featured']
def setUp(self):
super(TestAddonModelsFeatured, self).setUp()
# Addon._featured keeps an in-process cache we need to clear.
if hasattr(Addon, '_featured'):
del Addon._featured
@ -1595,6 +1600,7 @@ class TestBackupVersion(amo.tests.TestCase):
fixtures = ['addons/update', 'base/appversion']
def setUp(self):
super(TestBackupVersion, self).setUp()
self.version_1_2_0 = 105387
self.addon = Addon.objects.get(pk=1865)
set_user(None)
@ -1675,6 +1681,7 @@ class TestPersonaModel(amo.tests.TestCase):
fixtures = ['addons/persona']
def setUp(self):
super(TestPersonaModel, self).setUp()
self.addon = Addon.objects.get(id=15663)
self.persona = self.addon.persona
self.persona.header = 'header.png'
@ -1854,6 +1861,7 @@ class TestFlushURLs(amo.tests.TestCase):
'addons/persona']
def setUp(self):
super(TestFlushURLs, self).setUp()
settings.ADDON_ICON_URL = (
settings.STATIC_URL +
'img/uploads/addon_icons/%s/%s-%s.png?modified=%s')
@ -1867,6 +1875,7 @@ class TestFlushURLs(amo.tests.TestCase):
def tearDown(self):
_disconnect()
super(TestFlushURLs, self).tearDown()
def is_url_hashed(self, url):
return urlparse(url).query.find('modified') > -1
@ -2031,6 +2040,7 @@ class TestRemoveLocale(amo.tests.TestCase):
class TestUpdateNames(amo.tests.TestCase):
def setUp(self):
super(TestUpdateNames, self).setUp()
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
self.addon.name = self.names = {'en-US': 'woo'}
self.addon.save()
@ -2119,6 +2129,7 @@ class TestUpdateNames(amo.tests.TestCase):
class TestAddonWatchDisabled(amo.tests.TestCase):
def setUp(self):
super(TestAddonWatchDisabled, self).setUp()
self.addon = Addon(type=amo.ADDON_THEME, disabled_by_user=False,
status=amo.STATUS_PUBLIC)
self.addon.save()
@ -2244,6 +2255,7 @@ class TestLanguagePack(amo.tests.TestCase, amo.tests.AMOPaths):
class TestCompatOverride(amo.tests.TestCase):
def setUp(self):
super(TestCompatOverride, self).setUp()
self.app = amo.APP_IDS[1]
one = CompatOverride.objects.create(guid='one')
@ -2382,6 +2394,7 @@ class TestCompatOverride(amo.tests.TestCase):
class TestIncompatibleVersions(amo.tests.TestCase):
def setUp(self):
super(TestIncompatibleVersions, self).setUp()
self.app = amo.APP_IDS[amo.FIREFOX.id]
self.addon = Addon.objects.create(guid='r@b', type=amo.ADDON_EXTENSION)

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

@ -10,6 +10,7 @@ class TestExtract(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestExtract, self).setUp()
self.attrs = ('id', 'slug', 'created', 'last_updated',
'weekly_downloads', 'average_daily_users', 'status',
'type', 'hotness', 'is_disabled', 'premium_type')

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

@ -18,6 +18,7 @@ from services import theme_update
class TestWSGIApplication(amo.tests.TestCase):
def setUp(self):
super(TestWSGIApplication, self).setUp()
self.environ = {'wsgi.input': StringIO()}
self.start_response = mock.Mock()
@ -65,6 +66,7 @@ class TestThemeUpdate(amo.tests.TestCase):
fixtures = ['addons/persona']
def setUp(self):
super(TestThemeUpdate, self).setUp()
self.good = {
'username': 'persona_author',
'description': 'yolo',

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

@ -71,6 +71,7 @@ def test_hovercards(self, doc, addons, src=''):
class TestHomepage(amo.tests.TestCase):
def setUp(self):
super(TestHomepage, self).setUp()
self.base_url = reverse('home')
def test_thunderbird(self):
@ -103,6 +104,7 @@ class TestHomepageFeatures(amo.tests.TestCase):
'bandwagon/featured_collections']
def setUp(self):
super(TestHomepageFeatures, self).setUp()
self.url = reverse('home')
def test_no_unreviewed(self):
@ -165,6 +167,7 @@ class TestContributeInstalled(amo.tests.TestCase):
fixtures = ['base/appversion', 'base/addon_592']
def setUp(self):
super(TestContributeInstalled, self).setUp()
self.addon = Addon.objects.get(pk=592)
self.url = reverse('addons.installed', args=['a592'])
@ -195,6 +198,7 @@ class TestContributeEmbedded(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_592', 'base/users']
def setUp(self):
super(TestContributeEmbedded, self).setUp()
self.addon = Addon.objects.get(pk=592)
self.detail_url = self.addon.get_url_path()
@ -447,6 +451,7 @@ class TestLicensePage(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestLicensePage, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
@ -500,6 +505,7 @@ class TestDetailPage(amo.tests.TestCase):
'addons/persona']
def setUp(self):
super(TestDetailPage, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.url = self.addon.get_url_path()
@ -834,6 +840,7 @@ class TestImpalaDetailPage(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_592', 'base/users']
def setUp(self):
super(TestImpalaDetailPage, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.url = self.addon.get_url_path()
self.more_url = self.addon.get_url_path(more=True)
@ -1015,6 +1022,7 @@ class TestPersonas(object):
class TestPersonaDetailPage(TestPersonas, amo.tests.TestCase):
def setUp(self):
super(TestPersonas, self).setUp()
self.addon = Addon.objects.get(id=15663)
self.persona = self.addon.persona
self.url = self.addon.get_url_path()
@ -1089,6 +1097,7 @@ class TestStatus(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'addons/persona']
def setUp(self):
super(TestStatus, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.file = self.version.all_files[0]
@ -1197,6 +1206,7 @@ class TestEula(amo.tests.TestCase):
fixtures = ['addons/eula+contrib-addon']
def setUp(self):
super(TestEula, self).setUp()
self.addon = Addon.objects.get(id=11730)
self.url = self.get_url()
@ -1299,6 +1309,7 @@ class TestPrivacyPolicy(amo.tests.TestCase):
fixtures = ['addons/eula+contrib-addon']
def setUp(self):
super(TestPrivacyPolicy, self).setUp()
self.addon = Addon.objects.get(id=11730)
self.url = reverse('addons.privacy', args=[self.addon.slug])
@ -1333,6 +1344,7 @@ class TestReportAbuse(amo.tests.TestCase):
fixtures = ['addons/persona', 'base/addon_3615', 'base/users']
def setUp(self):
super(TestReportAbuse, self).setUp()
self.full_page = reverse('addons.abuse', args=['a3615'])
@patch('captcha.fields.ReCaptchaField.clean')

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

@ -862,6 +862,7 @@ class TestXss(TestCase):
fixtures = ['base/addon_3615', 'users/test_backends', ]
def setUp(self):
super(TestXss, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.name = "<script>alert('')</script>"
self.escaped = (

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

@ -128,11 +128,13 @@ def test_no_translation():
class TestLocalFileStorage(BaseTestCase):
def setUp(self):
super(TestLocalFileStorage, self).setUp()
self.tmp = tempfile.mkdtemp()
self.stor = LocalFileStorage()
def tearDown(self):
rm_local_tmp_dir(self.tmp)
super(TestLocalFileStorage, self).tearDown()
def test_read_write(self):
fn = os.path.join(self.tmp, 'somefile.txt')
@ -204,6 +206,7 @@ class TestLocalFileStorage(BaseTestCase):
class TestCacheNamespaces(BaseTestCase):
def setUp(self):
super(TestCacheNamespaces, self).setUp()
cache.clear()
self.namespace = 'redis-is-dead'

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

@ -80,9 +80,10 @@ class TestTaskUser(amo.tests.TestCase):
eq_(get_user().pk, 999)
class TestLoginRequired(object):
class TestLoginRequired(amo.tests.BaseTestCase):
def setUp(self):
super(TestLoginRequired, self).setUp()
self.f = mock.Mock()
self.f.__name__ = 'function'
self.request = mock.Mock()
@ -145,6 +146,7 @@ class TestSetModifiedOn(amo.tests.TestCase):
class TestPermissionRequired(amo.tests.TestCase):
def setUp(self):
super(TestPermissionRequired, self).setUp()
self.f = mock.Mock()
self.f.__name__ = 'function'
self.request = mock.Mock()

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

@ -48,6 +48,7 @@ class DecimalCharFieldTestCase(amo.tests.TestCase):
class SeparatedValuesFieldTestCase(amo.tests.TestCase):
def setUp(self):
super(SeparatedValuesFieldTestCase, self).setUp()
self.field = SeparatedValuesField(forms.EmailField)
def test_email_field(self):

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

@ -77,9 +77,10 @@ def test_page_title():
'x': encoding.smart_str(u'\u05d0\u05d5\u05e1\u05e3')})
class TestBreadcrumbs(object):
class TestBreadcrumbs(amo.tests.BaseTestCase):
def setUp(self):
super(TestBreadcrumbs, self).setUp()
self.req_noapp = Mock()
self.req_noapp.APP = None
self.req_app = Mock()

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

@ -11,6 +11,7 @@ from users.models import UserProfile
class LogTest(amo.tests.TestCase):
def setUp(self):
super(LogTest, self).setUp()
u = UserProfile.objects.create(username='foo')
amo.set_user(u)

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

@ -46,6 +46,7 @@ class TestModelBase(TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestModelBase, self).setUp()
self.saved_cb = amo.models._on_change_callbacks.copy()
amo.models._on_change_callbacks.clear()
self.cb = Mock()
@ -54,6 +55,7 @@ class TestModelBase(TestCase):
def tearDown(self):
amo.models._on_change_callbacks = self.saved_cb
super(TestModelBase, self).tearDown()
def test_multiple_ignored(self):
cb = Mock()

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

@ -28,6 +28,7 @@ class ReadOnlyModeTest(amo.tests.TestCase):
extra = ('amo.middleware.ReadOnlyMiddleware',)
def setUp(self):
super(ReadOnlyModeTest, self).setUp()
models.signals.pre_save.connect(self.db_error)
models.signals.pre_delete.connect(self.db_error)
self.old_settings = dict((k, quickcopy(getattr(settings, k)))
@ -49,6 +50,7 @@ class ReadOnlyModeTest(amo.tests.TestCase):
pass
models.signals.pre_save.disconnect(self.db_error)
models.signals.pre_delete.disconnect(self.db_error)
super(ReadOnlyModeTest, self).tearDown()
def db_error(self, *args, **kwargs):
raise mysql.OperationalError("You can't do this in read-only mode.")

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

@ -343,6 +343,7 @@ class TestPaginator(amo.tests.ESTestCase):
cls.setUpIndex()
def setUp(self):
super(TestPaginator, self).setUp()
self.request = request = mock.Mock()
request.GET.get.return_value = 1
request.GET.urlencode.return_value = ''

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

@ -23,11 +23,13 @@ class TestSendMail(BaseTestCase):
fixtures = ['base/users']
def setUp(self):
super(TestSendMail, self).setUp()
self._email_blacklist = list(getattr(settings, 'EMAIL_BLACKLIST', []))
def tearDown(self):
translation.activate('en_US')
settings.EMAIL_BLACKLIST = self._email_blacklist
super(TestSendMail, self).tearDown()
def test_send_string(self):
to = 'f@f.com'

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

@ -74,10 +74,12 @@ def test_rm_stored_dir():
class TestFileOps(BaseTestCase):
def setUp(self):
super(TestFileOps, self).setUp()
self.tmp = tempfile.mkdtemp()
def tearDown(self):
rm_local_tmp_dir(self.tmp)
super(TestFileOps, self).tearDown()
def path(self, path):
return os.path.join(self.tmp, path)

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

@ -15,6 +15,7 @@ class MiddlewareTest(BaseTestCase):
"""Tests that the locale and app redirection work properly."""
def setUp(self):
super(MiddlewareTest, self).setUp()
self.rf = RequestFactory()
self.middleware = LocaleAndAppURLMiddleware()
@ -120,11 +121,12 @@ class MiddlewareTest(BaseTestCase):
check('/en-US/firefox?lang=es-PE', '/es/firefox/')
class TestPrefixer:
class TestPrefixer(BaseTestCase):
def tearDown(self):
urlresolvers.clean_url_prefixes()
set_script_prefix('/')
super(TestPrefixer, self).tearDown()
def test_split_path(self):
@ -170,6 +172,7 @@ class TestPrefixer:
def test_reverse(self):
# Make sure it works outside the request.
urlresolvers.clean_url_prefixes() # Modified in BaseTestCase.
eq_(urlresolvers.reverse('home'), '/')
# With a request, locale and app prefixes work.

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

@ -27,6 +27,7 @@ class Test403(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(Test403, self).setUp()
assert self.client.login(username='regular@mozilla.com',
password='password')
@ -63,6 +64,7 @@ class TestCommon(amo.tests.TestCase):
fixtures = ('base/users', 'base/global-stats', 'base/addon_3615')
def setUp(self):
super(TestCommon, self).setUp()
self.url = reverse('home')
def login(self, user=None, get=False):
@ -337,6 +339,7 @@ class TestOtherStuff(amo.tests.TestCase):
class TestCSP(amo.tests.TestCase):
def setUp(self):
super(TestCSP, self).setUp()
self.url = reverse('amo.csp.report')
self.create_sample(name='csp-store-reports')

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

@ -185,6 +185,7 @@ class BaseOAuth(TestCase):
fixtures = ['base/users', 'base/appversion', 'base/licenses']
def setUp(self):
super(BaseOAuth, self).setUp()
self.editor = UserProfile.objects.get(email='editor@mozilla.com')
self.admin = UserProfile.objects.get(email='admin@mozilla.com')
consumers = []

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

@ -15,6 +15,7 @@ class TestDRFSwitch(TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestDRFSwitch, self).setUp()
self.factory = RequestFactory()
self.user = UserProfile.objects.get(email='del@icio.us')

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

@ -66,6 +66,7 @@ class UtilsTest(TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(UtilsTest, self).setUp()
self.a = Addon.objects.get(pk=3615)
def test_dict(self):
@ -695,6 +696,7 @@ class AddonFilterTest(TestCase):
fixtures = ['base/appversion']
def setUp(self):
super(AddonFilterTest, self).setUp()
# Start with 2 compatible add-ons.
self.addon1 = addon_factory(version_kw=dict(max_app_version='5.0'))
self.addon2 = addon_factory(version_kw=dict(max_app_version='6.0'))
@ -822,6 +824,7 @@ class TestGuidSearch(TestCase):
'{2fa4ed95-0317-4c6a-a74c-5f3e3912c1f9}')
def setUp(self):
super(TestGuidSearch, self).setUp()
addon = Addon.objects.get(id=3615)
c = CompatOverride.objects.create(guid=addon.guid)
app = addon.compatible_apps.keys()[0]
@ -932,6 +935,7 @@ class SearchTest(ESTestCase):
no_results = """<searchresults total_results="0">"""
def setUp(self):
super(SearchTest, self).setUp()
self.addons = Addon.objects.filter(status=amo.STATUS_PUBLIC,
disabled_by_user=False)
t = Tag.objects.create(tag_text='ballin')
@ -1271,13 +1275,11 @@ class LanguagePacks(UploadTest):
fixtures = ['addons/listed']
def setUp(self):
super(LanguagePacks, self).setUp()
self.url = reverse('api.language', args=['1.5'])
self.tb_url = self.url.replace('firefox', 'thunderbird')
self.addon = Addon.objects.get(pk=3723)
def tearDown(self):
pass
def test_search_language_pack(self):
self.addon.update(type=amo.ADDON_LPAPP, status=amo.STATUS_PUBLIC)
res = self.client.get(self.url)

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

@ -33,6 +33,7 @@ class TestCollections(amo.tests.TestCase):
'base/user_4043307')
def setUp(self):
super(TestCollections, self).setUp()
self.user = UserProfile.objects.create(username='uhhh', email='uh@hh')
self.other = UserProfile.objects.exclude(id=self.user.id)[0]
amo.set_user(self.user)

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

@ -238,6 +238,7 @@ class TestPrivacy(amo.tests.TestCase):
fixtures = ['users/test_backends']
def setUp(self):
super(TestPrivacy, self).setUp()
# The favorites collection is created automatically.
self.url = reverse('collections.detail', args=['jbalogh', 'favorites'])
self.client.login(username='jbalogh@mozilla.com', password='password')
@ -287,6 +288,7 @@ class TestVotes(amo.tests.TestCase):
fixtures = ['users/test_backends']
def setUp(self):
super(TestVotes, self).setUp()
self.client.login(username='jbalogh@mozilla.com', password='password')
args = ['fligtar', 'slug']
Collection.objects.create(slug='slug', author_id=9945)
@ -351,6 +353,7 @@ class TestCRUD(amo.tests.TestCase):
fixtures = ('base/users', 'base/addon_3615', 'base/collections')
def setUp(self):
super(TestCRUD, self).setUp()
self.client = HappyUnicodeClient()
self.add_url = reverse('collections.add')
self.login_admin()
@ -824,6 +827,7 @@ class TestChangeAddon(amo.tests.TestCase):
fixtures = ['users/test_backends']
def setUp(self):
super(TestChangeAddon, self).setUp()
self.client.login(username='jbalogh@mozilla.com', password='password')
self.add = reverse('collections.alter',
args=['jbalogh', 'mobile', 'add'])
@ -924,6 +928,7 @@ class AjaxTest(amo.tests.TestCase):
'base/addon_5299_gcal', 'base/collections')
def setUp(self):
super(AjaxTest, self).setUp()
assert self.client.login(username='clouserw@gmail.com',
password='password')
self.user = UserProfile.objects.get(email='clouserw@gmail.com')
@ -992,6 +997,7 @@ class TestWatching(amo.tests.TestCase):
fixtures = ['base/users', 'base/collection_57181']
def setUp(self):
super(TestWatching, self).setUp()
self.collection = c = Collection.objects.get(id=57181)
self.url = reverse('collections.watch',
args=[c.author.username, c.slug])
@ -1064,6 +1070,7 @@ class TestCollectionListing(amo.tests.TestCase):
'base/collections', 'bandwagon/featured_collections']
def setUp(self):
super(TestCollectionListing, self).setUp()
cache.clear()
self.url = reverse('collections.list')
@ -1168,6 +1175,7 @@ class TestCollectionDetailFeed(amo.tests.TestCase):
fixtures = ['base/collection_57181']
def setUp(self):
super(TestCollectionDetailFeed, self).setUp()
self.collection = c = Collection.objects.get(id=57181)
self.feed_url = reverse('collections.detail.rss',
args=[c.author.username, c.slug])

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

@ -164,6 +164,7 @@ class TestListing(amo.tests.TestCase):
'base/addon_3615']
def setUp(self):
super(TestListing, self).setUp()
cache.clear()
self.url = reverse('browse.extensions')
@ -400,6 +401,7 @@ class TestFeeds(amo.tests.TestCase):
'base/addon_3615']
def setUp(self):
super(TestFeeds, self).setUp()
cache.clear()
self.url = reverse('browse.extensions')
self.rss_url = reverse('browse.extensions.rss')
@ -494,6 +496,7 @@ class TestFeaturedLocale(amo.tests.TestCase):
'base/addon_3615_featuredcollection']
def setUp(self):
super(TestFeaturedLocale, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.persona = Addon.objects.get(pk=15679)
self.extension = Addon.objects.get(pk=2464)
@ -729,6 +732,7 @@ class TestListingByStatus(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestListingByStatus, self).setUp()
self.addon = Addon.objects.get(id=3615)
def get_addon(self, addon_status, file_status):
@ -1110,6 +1114,7 @@ class TestLegacyRedirects(amo.tests.TestCase):
class TestCategoriesFeed(amo.tests.TestCase):
def setUp(self):
super(TestCategoriesFeed, self).setUp()
self.feed = feeds.CategoriesRss()
self.u = u'Ελληνικά'
self.wut = Translation(localized_string=self.u, locale='el')
@ -1162,6 +1167,7 @@ class TestPersonas(amo.tests.TestCase):
'addons/featured', 'addons/persona')
def setUp(self):
super(TestPersonas, self).setUp()
self.landing_url = reverse('browse.personas')
self.upandcoming_url = '{path}?sort=up-and-coming'.format(
path=self.landing_url)
@ -1341,6 +1347,7 @@ class TestMobileHeader(amo.tests.MobileTest, amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestMobileHeader, self).setUp()
self.url = reverse('browse.extensions')
def get_pq(self):

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

@ -44,6 +44,7 @@ class TestIndex(amo.tests.TestCase):
# TODO: Test valid version processing here.
def setUp(self):
super(TestIndex, self).setUp()
self.url = reverse('compat.index', args=[amo.COMPAT[0]['main']])
CompatTotals.objects.create(app=1, total=1)
@ -71,6 +72,7 @@ class TestIndex(amo.tests.TestCase):
class TestIncoming(amo.tests.TestCase):
def setUp(self):
super(TestIncoming, self).setUp()
self.url = reverse('compat.incoming')
self.data = dict(incoming_data)
self.json = json.dumps(self.data)
@ -133,6 +135,7 @@ class TestReporterDetail(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestReporterDetail, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.url = reverse('compat.reporter_detail', args=[self.addon.guid])
self.reports = []

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

@ -36,6 +36,7 @@ class TestPurify(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestPurify, self).setUp()
self.addon = Addon.objects.get(pk=3615)
def test_no_html(self):

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

@ -62,6 +62,7 @@ class TestContribForm(amo.tests.TestCase):
class TestCharityForm(amo.tests.TestCase):
def setUp(self):
super(TestCharityForm, self).setUp()
self.paypal_mock = mock.Mock()
self.paypal_mock.return_value = (True, None)
paypal.check_paypal_id = self.paypal_mock
@ -102,6 +103,7 @@ class TestPreviewForm(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestPreviewForm, self).setUp()
self.dest = os.path.join(settings.TMP_PATH, 'preview')
if not os.path.exists(self.dest):
os.makedirs(self.dest)
@ -135,6 +137,7 @@ class TestThemeForm(amo.tests.TestCase):
fixtures = ['base/user_2519']
def setUp(self):
super(TestThemeForm, self).setUp()
self.populate()
self.request = mock.Mock()
self.request.groups = ()
@ -380,6 +383,7 @@ class TestEditThemeForm(amo.tests.TestCase):
fixtures = ['base/user_2519']
def setUp(self):
super(TestEditThemeForm, self).setUp()
self.populate()
self.request = mock.Mock()
self.request.groups = ()
@ -576,6 +580,7 @@ class TestEditThemeOwnerForm(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestEditThemeOwnerForm, self).setUp()
self.instance = Addon.objects.create(
type=amo.ADDON_PERSONA,
status=amo.STATUS_PUBLIC, slug='swag-overload',

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

@ -42,6 +42,7 @@ def test_dev_page_title():
class TestDevBreadcrumbs(amo.tests.BaseTestCase):
def setUp(self):
super(TestDevBreadcrumbs, self).setUp()
self.request = Mock()
self.request.APP = None
@ -140,6 +141,7 @@ def test_log_action_class():
class TestDisplayUrl(amo.tests.BaseTestCase):
def setUp(self):
super(TestDisplayUrl, self).setUp()
self.raw_url = u'http://host/%s' % 'フォクすけといっしょ'.decode('utf8')
def test_utf8(self):
@ -162,6 +164,7 @@ class TestDisplayUrl(amo.tests.BaseTestCase):
class TestDevFilesStatus(amo.tests.TestCase):
def setUp(self):
super(TestDevFilesStatus, self).setUp()
self.addon = Addon.objects.create(type=1, status=amo.STATUS_UNREVIEWED)
self.version = Version.objects.create(addon=self.addon)
self.file = File.objects.create(version=self.version,

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

@ -26,6 +26,7 @@ class TestActivityLog(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestActivityLog, self).setUp()
u = UserProfile.objects.create(username='yolo')
self.request = Mock()
self.request.amo_user = self.user = u
@ -33,6 +34,7 @@ class TestActivityLog(amo.tests.TestCase):
def tearDown(self):
amo.set_user(None)
super(TestActivityLog, self).tearDown()
def test_basic(self):
a = Addon.objects.get()
@ -178,6 +180,7 @@ class TestVersion(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615', 'base/thunderbird']
def setUp(self):
super(TestVersion, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.version = Version.objects.get(pk=81551)
self.file = File.objects.get(pk=67442)
@ -233,6 +236,7 @@ class TestActivityLogCount(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestActivityLogCount, self).setUp()
now = datetime.now()
bom = datetime(now.year, now.month, 1)
self.lm = bom - timedelta(days=1)

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

@ -19,6 +19,7 @@ class TestPerf(amo.tests.TestCase):
fixtures = ['devhub/addon-validation-1']
def setUp(self):
super(TestPerf, self).setUp()
self.file = File.objects.get(
version__addon__slug='searchaddon11102010')

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

@ -95,6 +95,7 @@ def _uploader(resize_size, final_size):
class TestValidator(amo.tests.TestCase):
def setUp(self):
super(TestValidator, self).setUp()
self.upload = FileUpload.objects.create()
assert not self.upload.valid
@ -127,6 +128,7 @@ class TestFlagBinary(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestFlagBinary, self).setUp()
self.addon = Addon.objects.get(pk=3615)
@mock.patch('devhub.tasks.run_validator')

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

@ -47,6 +47,7 @@ class HubTest(amo.tests.TestCase):
fixtures = ['browse/nameless-addon', 'base/users']
def setUp(self):
super(HubTest, self).setUp()
self.url = reverse('devhub.index')
assert self.client.login(username='regular@mozilla.com',
password='password')
@ -266,6 +267,7 @@ class TestUpdateCompatibility(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_4594_a9', 'base/addon_3615']
def setUp(self):
super(TestUpdateCompatibility, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
self.url = reverse('devhub.addons')
@ -275,6 +277,7 @@ class TestUpdateCompatibility(amo.tests.TestCase):
def tearDown(self):
amo.FIREFOX.latest_version, amo.MOBILE.latest_version = self._versions
super(TestUpdateCompatibility, self).tearDown()
def test_no_compat(self):
self.client.logout()
@ -331,6 +334,7 @@ class TestDevRequired(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestDevRequired, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.get_url = self.addon.get_dev_url('payments')
self.post_url = self.addon.get_dev_url('payments.disable')
@ -375,6 +379,7 @@ class TestVersionStats(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestVersionStats, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
@ -398,6 +403,7 @@ class TestEditPayments(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestEditPayments, self).setUp()
self.addon = self.get_addon()
self.addon.the_reason = self.addon.the_future = '...'
self.addon.save()
@ -606,6 +612,7 @@ class TestDisablePayments(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestDisablePayments, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.addon.the_reason = self.addon.the_future = '...'
self.addon.save()
@ -633,6 +640,7 @@ class TestPaymentsProfile(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestPaymentsProfile, self).setUp()
self.addon = a = self.get_addon()
self.url = self.addon.get_dev_url('payments')
# Make sure all the payment/profile data is clear.
@ -716,6 +724,7 @@ class TestDelete(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestDelete, self).setUp()
self.get_addon = lambda: Addon.objects.filter(id=3615)
assert self.client.login(username='del@icio.us', password='password')
self.get_url = lambda: self.get_addon()[0].get_dev_url('delete')
@ -744,6 +753,7 @@ class TestHome(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestHome, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
self.url = reverse('devhub.index')
@ -879,6 +889,7 @@ class TestProfileBase(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestProfileBase, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.url = self.addon.get_dev_url('profile')
@ -1035,6 +1046,7 @@ class TestSubmitBase(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_5579', 'base/users']
def setUp(self):
super(TestSubmitBase, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
self.addon = self.get_addon()
@ -1078,6 +1090,7 @@ class TestSubmitStep2(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestSubmitStep2, self).setUp()
self.client.login(username='regular@mozilla.com', password='password')
def test_step_2_with_cookie(self):
@ -1678,6 +1691,7 @@ class TestSubmitSteps(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestSubmitSteps, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
def assert_linked(self, doc, numbers):
@ -2616,6 +2630,7 @@ class TestDeleteAddon(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestDeleteAddon, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.url = self.addon.get_dev_url('delete')
self.client.login(username='admin@mozilla.com', password='password')
@ -2638,6 +2653,7 @@ class TestRequestReview(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestRequestReview, self).setUp()
self.addon = Addon.objects.create(type=1, name='xxx')
self.version = Version.objects.create(addon=self.addon)
self.file = File.objects.create(version=self.version,
@ -2741,6 +2757,7 @@ class TestRedirects(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestRedirects, self).setUp()
self.base = reverse('devhub.index')
assert self.client.login(username='admin@mozilla.com',
password='password')
@ -2798,6 +2815,7 @@ class TestRemoveLocale(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestRemoveLocale, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.url = reverse('devhub.addons.remove-locale', args=['a3615'])
assert self.client.login(username='del@icio.us', password='password')

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

@ -1259,6 +1259,7 @@ class TestThemeEdit(amo.tests.TestCase):
fixtures = ['base/user_999']
def setUp(self):
super(TestThemeEdit, self).setUp()
self.addon = addon_factory(type=amo.ADDON_PERSONA)
self.user = UserProfile.objects.get()
self.addon.addonuser_set.create(user=self.user)

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

@ -15,6 +15,7 @@ class TestOwnership(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestOwnership, self).setUp()
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.url = self.addon.get_dev_url('owner')

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

@ -241,6 +241,7 @@ class TestPackagerDownload(amo.tests.TestCase):
fixtures = ['base/users', 'base/appversion', 'base/addon_3615']
def setUp(self):
super(TestPackagerDownload, self).setUp()
self.url = lambda f: reverse('devhub.package_addon_json', args=[f])
def _prep_mock_package(self, name):

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

@ -27,9 +27,9 @@ class TestPerfViews(amo.tests.TestCase):
self.perf_calls = None
def tearDown(self):
super(TestPerfViews, self).tearDown()
for p in self.patches:
p.stop()
super(TestPerfViews, self).tearDown()
def assert_call(self, expected_call):
if not self.perf_calls:

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

@ -15,6 +15,7 @@ class TestSubmitPersona(amo.tests.TestCase):
fixtures = ['base/user_999']
def setUp(self):
super(TestSubmitPersona, self).setUp()
assert self.client.login(username='regular@mozilla.com',
password='password')
self.url = reverse('devhub.themes.submit')

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

@ -97,6 +97,7 @@ class TestFileValidation(amo.tests.TestCase):
fixtures = ['base/users', 'devhub/addon-validation-1']
def setUp(self):
super(TestFileValidation, self).setUp()
assert self.client.login(username='del@icio.us', password='password')
self.user = UserProfile.objects.get(email='del@icio.us')
self.file_validation = FileValidation.objects.get(pk=1)
@ -215,9 +216,9 @@ class TestValidateFile(BaseUploadTest):
self.addon = self.file.version.addon
def tearDown(self):
super(TestValidateFile, self).tearDown()
if storage.exists(self.file.file_path):
storage.delete(self.file.file_path)
super(TestValidateFile, self).tearDown()
@attr('validator')
def test_lazy_validate(self):

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

@ -23,7 +23,8 @@ class TestVersion(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
super(TestVersion, self).setUp()
self.client.login(username='del@icio.us', password='password')
self.user = UserProfile.objects.get(email='del@icio.us')
self.addon = self.get_addon()
self.version = Version.objects.get(id=81551)
@ -344,19 +345,7 @@ class TestVersion(amo.tests.TestCase):
set(['checkbox']))
class TestVersionEdit(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615', 'base/thunderbird']
def setUp(self):
assert self.client.login(username='del@icio.us', password='password')
self.addon = self.get_addon()
self.version = self.get_version()
self.url = reverse('devhub.versions.edit',
args=['a3615', self.version.id])
self.v1, _created = AppVersion.objects.get_or_create(
application=amo.FIREFOX.id, version='1.0')
self.v5, _created = AppVersion.objects.get_or_create(
application=amo.FIREFOX.id, version='5.0')
class TestVersionEditMixin(object):
def get_addon(self):
return Addon.objects.no_cache().get(id=3615)
@ -370,7 +359,23 @@ class TestVersionEdit(amo.tests.TestCase):
return formset(*args, **defaults)
class TestVersionEditMobile(TestVersionEdit):
class TestVersionEditBase(TestVersionEditMixin, amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615', 'base/thunderbird']
def setUp(self):
super(TestVersionEditBase, self).setUp()
self.client.login(username='del@icio.us', password='password')
self.addon = self.get_addon()
self.version = self.get_version()
self.url = reverse('devhub.versions.edit',
args=['a3615', self.version.id])
self.v1, _created = AppVersion.objects.get_or_create(
application=amo.FIREFOX.id, version='1.0')
self.v5, _created = AppVersion.objects.get_or_create(
application=amo.FIREFOX.id, version='5.0')
class TestVersionEditMobile(TestVersionEditBase):
def setUp(self):
super(TestVersionEditMobile, self).setUp()
@ -391,7 +396,7 @@ class TestVersionEditMobile(TestVersionEdit):
['android', 'maemo'])
class TestVersionEditDetails(TestVersionEdit):
class TestVersionEditDetails(TestVersionEditBase):
def setUp(self):
super(TestVersionEditDetails, self).setUp()
@ -477,13 +482,14 @@ class TestVersionEditDetails(TestVersionEdit):
assert not Version.objects.get(pk=self.version.pk).source
class TestVersionEditSearchEngine(TestVersionEdit):
class TestVersionEditSearchEngine(TestVersionEditMixin,
amo.tests.BaseTestCase):
# https://bugzilla.mozilla.org/show_bug.cgi?id=605941
fixtures = ['base/users', 'base/thunderbird', 'base/addon_4594_a9.json']
def setUp(self):
assert self.client.login(username='admin@mozilla.com',
password='password')
super(TestVersionEditSearchEngine, self).setUp()
self.client.login(username='admin@mozilla.com', password='password')
self.url = reverse('devhub.versions.edit',
args=['a4594', 42352])
@ -515,7 +521,7 @@ class TestVersionEditSearchEngine(TestVersionEdit):
assert doc('a.add-file')
class TestVersionEditFiles(TestVersionEdit):
class TestVersionEditFiles(TestVersionEditBase):
def setUp(self):
super(TestVersionEditFiles, self).setUp()
@ -659,12 +665,12 @@ class TestVersionEditFiles(TestVersionEdit):
sorted([p.shortname for p in amo.MOBILE_PLATFORMS.values()]))
class TestPlatformSearch(TestVersionEdit):
class TestPlatformSearch(TestVersionEditMixin, amo.tests.BaseTestCase):
fixtures = ['base/users', 'base/thunderbird', 'base/addon_4594_a9.json']
def setUp(self):
assert self.client.login(username='admin@mozilla.com',
password='password')
super(TestPlatformSearch, self).setUp()
self.client.login(username='admin@mozilla.com', password='password')
self.url = reverse('devhub.versions.edit',
args=['a4594', 42352])
self.version = Version.objects.get(id=42352)
@ -686,7 +692,7 @@ class TestPlatformSearch(TestVersionEdit):
eq_(amo.PLATFORM_ALL.id, file_.platform)
class TestVersionEditCompat(TestVersionEdit):
class TestVersionEditCompat(TestVersionEditBase):
def get_form(self, url=None):
if not url:

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

@ -307,6 +307,7 @@ class TestPane(amo.tests.TestCase):
'bandwagon/featured_collections']
def setUp(self):
super(TestPane, self).setUp()
self.url = reverse('discovery.pane', args=['3.7a1pre', 'Darwin'])
def test_my_account(self):
@ -397,6 +398,7 @@ class TestDetails(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_592']
def setUp(self):
super(TestDetails, self).setUp()
self.addon = self.get_addon()
self.detail_url = reverse('discovery.addons.detail',
args=[self.addon.slug])
@ -455,6 +457,7 @@ class TestPersonaDetails(amo.tests.TestCase):
fixtures = ['addons/persona', 'base/users']
def setUp(self):
super(TestPersonaDetails, self).setUp()
self.addon = Addon.objects.get(id=15663)
self.url = reverse('discovery.addons.detail', args=[self.addon.slug])
@ -500,6 +503,7 @@ class TestDownloadSources(amo.tests.TestCase):
'discovery/discoverymodules']
def setUp(self):
super(TestDownloadSources, self).setUp()
self.url = reverse('discovery.pane', args=['3.7a1pre', 'Darwin'])
def test_detail(self):
@ -546,6 +550,7 @@ class TestMonthlyPick(amo.tests.TestCase):
'discovery/discoverymodules']
def setUp(self):
super(TestMonthlyPick, self).setUp()
self.url = reverse('discovery.pane.promos', args=['Darwin', '10.0'])
self.addon = Addon.objects.get(id=3615)
DiscoveryModule.objects.create(
@ -600,6 +605,7 @@ class TestPaneMoreAddons(amo.tests.TestCase):
fixtures = ['base/appversion']
def setUp(self):
super(TestPaneMoreAddons, self).setUp()
self.addon1 = addon_factory(hotness=99,
version_kw=dict(max_app_version='5.0'))
self.addon2 = addon_factory(hotness=0,

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

@ -15,6 +15,7 @@ class TestReviewActions(amo.tests.TestCase):
fixtures = ('base/users', 'base/addon_3615')
def setUp(self):
super(TestReviewActions, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.version = self.addon.versions.all()[0]

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

@ -162,6 +162,8 @@ class TestReviewHelper(amo.tests.TestCase):
preamble = 'Mozilla Add-ons: Delicious Bookmarks 2.1.072'
def setUp(self):
super(TestReviewHelper, self).setUp()
class FakeRequest:
amo_user = UserProfile.objects.get(pk=10482)
user = amo_user
@ -698,6 +700,7 @@ class TestCompareLink(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestCompareLink, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.current = File.objects.get(pk=67442)
self.version = Version.objects.create(addon=self.addon)

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

@ -330,6 +330,7 @@ class TestEditorSubscription(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestEditorSubscription, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.version = self.addon.current_version
self.user_one = UserProfile.objects.get(pk=55021)
@ -387,6 +388,7 @@ class TestReviewerScore(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestReviewerScore, self).setUp()
self.addon = amo.tests.addon_factory(status=amo.STATUS_NOMINATED)
self.user = UserProfile.objects.get(email='editor@mozilla.com')

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

@ -59,6 +59,7 @@ class EditorTest(amo.tests.TestCase):
class TestEventLog(EditorTest):
def setUp(self):
super(TestEventLog, self).setUp()
self.login_as_editor()
self.url = reverse('editors.eventlog')
amo.set_user(UserProfile.objects.get(username='editor'))
@ -118,6 +119,7 @@ class TestReviewLog(EditorTest):
fixtures = EditorTest.fixtures + ['base/addon_3615']
def setUp(self):
super(TestReviewLog, self).setUp()
self.login_as_editor()
self.url = reverse('editors.reviewlog')
@ -300,6 +302,7 @@ class TestHome(EditorTest):
fixtures = EditorTest.fixtures + ['base/addon_3615']
def setUp(self):
super(TestHome, self).setUp()
self.login_as_editor()
self.url = reverse('editors.home')
self.user = UserProfile.objects.get(id=5497308)
@ -1090,6 +1093,7 @@ class TestPerformance(QueueTest):
class SearchTest(EditorTest):
def setUp(self):
super(SearchTest, self).setUp()
self.login_as_editor()
def named_addons(self, request):
@ -1440,6 +1444,7 @@ class TestQueueSearchVersionSpecific(SearchTest):
class ReviewBase(QueueTest):
def setUp(self):
super(QueueTest, self).setUp()
self.login_as_editor()
self.addons = {}
@ -2243,6 +2248,7 @@ class TestLeaderboard(EditorTest):
fixtures = ['base/users']
def setUp(self):
super(TestLeaderboard, self).setUp()
self.url = reverse('editors.leaderboard')
self.user = UserProfile.objects.get(email='editor@mozilla.com')

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

@ -26,6 +26,7 @@ class ThemeReviewTestMixin(object):
'editors/user_senior_persona_reviewer']
def setUp(self):
super(ThemeReviewTestMixin, self).setUp()
self.reviewer_count = 0
self.status = amo.STATUS_PENDING
self.flagged = False
@ -605,6 +606,7 @@ class TestDeletedThemeLookup(amo.tests.TestCase):
'editors/user_senior_persona_reviewer']
def setUp(self):
super(TestDeletedThemeLookup, self).setUp()
self.deleted = addon_factory(type=amo.ADDON_PERSONA)
self.deleted.update(status=amo.STATUS_DELETED)
@ -625,6 +627,7 @@ class TestThemeSearch(amo.tests.ESTestCase):
fixtures = ['editors/user_senior_persona_reviewer']
def setUp(self):
super(TestThemeSearch, self).setUp()
self.addon = addon_factory(type=amo.ADDON_PERSONA, name='themeteam',
status=amo.STATUS_PENDING)
self.refresh('default')
@ -658,6 +661,7 @@ class TestDashboard(amo.tests.TestCase):
fixtures = ['editors/user_senior_persona_reviewer']
def setUp(self):
super(TestDashboard, self).setUp()
self.request = amo.tests.req_factory_factory(
reverse('editors.themes.home'), user=UserProfile.objects.get())

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

@ -11,6 +11,7 @@ from files.decorators import allowed
class AllowedTest(amo.tests.TestCase):
def setUp(self):
super(AllowedTest, self).setUp()
self.request = Mock()
self.file = Mock()

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

@ -37,10 +37,12 @@ def make_file(pk, file_path, **kwargs):
class TestFileHelper(amo.tests.TestCase):
def setUp(self):
super(TestFileHelper, self).setUp()
self.viewer = FileViewer(make_file(1, get_file('dictionary-test.xpi')))
def tearDown(self):
self.viewer.cleanup()
super(TestFileHelper, self).tearDown()
def test_files_not_extracted(self):
eq_(self.viewer.is_extracted(), False)
@ -204,6 +206,7 @@ class TestSearchEngineHelper(amo.tests.TestCase):
fixtures = ['base/addon_4594_a9']
def setUp(self):
super(TestSearchEngineHelper, self).setUp()
self.left = File.objects.get(pk=25753)
self.viewer = FileViewer(self.left)
@ -214,6 +217,7 @@ class TestSearchEngineHelper(amo.tests.TestCase):
def tearDown(self):
self.viewer.cleanup()
super(TestSearchEngineHelper, self).tearDown()
def test_is_search_engine(self):
assert self.viewer.is_search_engine()
@ -235,6 +239,7 @@ class TestSearchEngineHelper(amo.tests.TestCase):
class TestDiffSearchEngine(amo.tests.TestCase):
def setUp(self):
super(TestDiffSearchEngine, self).setUp()
src = os.path.join(settings.ROOT, get_file('search.xml'))
if not storage.exists(src):
with storage.open(src, 'w') as f:
@ -244,6 +249,7 @@ class TestDiffSearchEngine(amo.tests.TestCase):
def tearDown(self):
self.helper.cleanup()
super(TestDiffSearchEngine, self).tearDown()
@patch('files.helpers.FileViewer.is_search_engine')
def test_diff_search(self, is_search_engine):
@ -258,11 +264,13 @@ class TestDiffSearchEngine(amo.tests.TestCase):
class TestDiffHelper(amo.tests.TestCase):
def setUp(self):
super(TestDiffHelper, self).setUp()
src = os.path.join(settings.ROOT, get_file('dictionary-test.xpi'))
self.helper = DiffHelper(make_file(1, src), make_file(2, src))
def tearDown(self):
self.helper.cleanup()
super(TestDiffHelper, self).tearDown()
def test_files_not_extracted(self):
eq_(self.helper.is_extracted(), False)

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

@ -290,6 +290,7 @@ class TestFile(amo.tests.TestCase, amo.tests.AMOPaths):
class TestParseXpi(amo.tests.TestCase):
def setUp(self):
super(TestParseXpi, self).setUp()
for version in ('3.0', '3.6.*'):
AppVersion.objects.create(application=amo.FIREFOX.id,
version=version)
@ -429,6 +430,7 @@ class TestParseAlternateXpi(amo.tests.TestCase, amo.tests.AMOPaths):
# This install.rdf is completely different from our other xpis.
def setUp(self):
super(TestParseAlternateXpi, self).setUp()
for version in ('3.0', '4.0b3pre'):
AppVersion.objects.create(application=amo.FIREFOX.id,
version=version)
@ -1031,6 +1033,7 @@ class TestCheckJetpackVersion(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestCheckJetpackVersion, self).setUp()
self.addon = Addon.objects.get(id=3615)
JetpackUpgrader().jetpack_versions('1.0', '1.1')

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

@ -99,6 +99,7 @@ class TestRepackageJetpack(amo.tests.TestCase):
def tearDown(self):
storage.delete(self.tmp_file_path)
super(TestRepackageJetpack, self).tearDown()
def create_temp_file(self):
path = tempfile.mktemp(dir=settings.TMP_PATH)

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

@ -33,6 +33,7 @@ class TestFindJetpacks(amo.tests.TestCase):
fixtures = ['base/addon_3615']
def setUp(self):
super(TestFindJetpacks, self).setUp()
File.objects.update(jetpack_version='1.0')
self.file = File.objects.filter(version__addon=3615).get()

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

@ -28,13 +28,14 @@ not_binary = 'install.js'
binary = 'dictionaries/ar.dic'
class FilesBase:
class FilesBase(object):
def login_as_editor(self):
assert self.client.login(username='editor@mozilla.com',
password='password')
def setUp(self):
super(FilesBase, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.dev = self.addon.authors.all()[0]
self.regular = UserProfile.objects.get(pk=999)
@ -73,6 +74,7 @@ class FilesBase:
def tearDown(self):
self.file_viewer.cleanup()
super(FilesBase, self).tearDown()
def files_redirect(self, file):
return reverse('files.redirect', args=[self.file.pk, file])

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

@ -12,6 +12,7 @@ from landfill.collection import generate_collection
class CollectionsTests(amo.tests.TestCase):
def setUp(self):
super(CollectionsTests, self).setUp()
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
def test_collections_themes_generation(self):

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

@ -10,6 +10,7 @@ from landfill.ratings import generate_ratings
class RatingsTests(amo.tests.TestCase):
def setUp(self):
super(RatingsTests, self).setUp()
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
def test_ratings_generation(self):

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

@ -11,6 +11,7 @@ from landfill.user import generate_addon_user_and_category, generate_user
class RatingsTests(amo.tests.TestCase):
def setUp(self):
super(RatingsTests, self).setUp()
self.email = 'nobody@mozilla.org'
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)

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

@ -57,6 +57,7 @@ class TestCategory(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestCategory, self).setUp()
self.cat1 = Category.objects.create(name='Causes',
type=amo.ADDON_EXTENSION)
self.cat1.name = {'es': u'Campañas', 'zh-CN': u'原因'}

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

@ -33,6 +33,7 @@ good_token = urllib.urlencode({'token': 'foo', 'secret': 'bar'})
class TestPayKey(amo.tests.TestCase):
def setUp(self):
super(TestPayKey, self).setUp()
self.data = {'slug': 'xx',
'amount': 10,
'email': 'someone@somewhere.com',

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

@ -60,6 +60,7 @@ sample_contribution = {
class PaypalTest(amo.tests.TestCase):
def setUp(self):
super(PaypalTest, self).setUp()
self.url = reverse('amo.paypal')
self.item = 1234567890
self.client = Client()

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

@ -12,6 +12,7 @@ class TestModels(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/addon_5299_gcal', 'perf/index']
def setUp(self):
super(TestModels, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.results = self.addon.performance.all()
self.result = self.results[0]

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

@ -11,6 +11,7 @@ class FeedTest(amo.tests.TestCase):
# Rub some unicode all over the reviews feed.
def setUp(self):
super(FeedTest, self).setUp()
self.feed = feeds.ReviewsRss()
self.u = u'Ελληνικά'
self.wut = Translation(localized_string=self.u, locale='el')

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

@ -72,6 +72,7 @@ class TestRefreshTest(amo.tests.ESTestCase):
fixtures = ['base/users']
def setUp(self):
super(TestRefreshTest, self).setUp()
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
self.user = UserProfile.objects.all()[0]
self.refresh()

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

@ -17,6 +17,7 @@ class ReviewTest(amo.tests.TestCase):
fixtures = ['reviews/dev-reply.json', 'base/admin']
def setUp(self):
super(ReviewTest, self).setUp()
self.addon = Addon.objects.get(id=1865)
def login_dev(self):
@ -469,6 +470,7 @@ class TestMobileReviews(amo.tests.MobileTest, amo.tests.TestCase):
fixtures = ['reviews/dev-reply.json', 'base/admin', 'base/users']
def setUp(self):
super(TestMobileReviews, self).setUp()
self.addon = Addon.objects.get(id=1865)
self.user = UserProfile.objects.get(email='regular@mozilla.com')
self.login_regular()

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

@ -11,6 +11,7 @@ from search.middleware import ElasticsearchExceptionMiddleware as ESM
class TestElasticsearchExceptionMiddleware(amo.tests.TestCase):
def setUp(self):
super(TestElasticsearchExceptionMiddleware, self).setUp()
self.request = RequestFactory()
@mock.patch('search.middleware.render')

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

@ -134,6 +134,7 @@ class TestESSearch(SearchBase):
cls.setUpIndex()
def setUp(self):
super(TestESSearch, self).setUp()
self.url = reverse('search.search')
self.addons = Addon.objects.filter(status=amo.STATUS_PUBLIC,
disabled_by_user=False)
@ -622,6 +623,7 @@ class TestPersonaSearch(SearchBase):
cls.setUpIndex()
def setUp(self):
super(TestPersonaSearch, self).setUp()
self.url = urlparams(reverse('search.search'), atype=amo.ADDON_PERSONA)
def _generate_personas(self):
@ -1167,6 +1169,7 @@ class TestGenericAjaxSearch(TestAjaxSearch):
class TestSearchSuggestions(TestAjaxSearch):
def setUp(self):
super(TestSearchSuggestions, self).setUp()
self.url = reverse('search.suggestions')
self._addons += [
amo.tests.addon_factory(name='addon persona',

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

@ -31,12 +31,14 @@ class FixturesFolderMixin(object):
os.rmdir(dirpath)
def setUp(self):
super(FixturesFolderMixin, self).setUp()
self.clean_up_files()
shutil.copytree(os.path.join(hive_folder, self.source_folder),
os.path.join(hive_folder, self.date))
def tearDown(self):
self.clean_up_files()
super(FixturesFolderMixin, self).tearDown()
class TestADICommand(FixturesFolderMixin, amo.tests.TestCase):

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

@ -86,6 +86,7 @@ class TestIndexStats(amo.tests.TestCase):
fixtures = ['stats/test_models']
def setUp(self):
super(TestIndexStats, self).setUp()
self.downloads = (DownloadCount.objects.order_by('-date')
.values_list('id', flat=True))
self.updates = (UpdateCount.objects.order_by('-date')

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

@ -37,6 +37,7 @@ class TestEmail(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestEmail, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.user = UserProfile.objects.get(pk=999)

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

@ -715,6 +715,7 @@ class TestResponses(ESStatsTest):
class TestSiteQuery(amo.tests.TestCase):
def setUp(self):
super(TestSiteQuery, self).setUp()
self.start = datetime.date(2012, 1, 1)
self.end = datetime.date(2012, 1, 31)
for k in xrange(0, 15):

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

@ -83,9 +83,9 @@ class TranslationTestCase(BaseTestCase):
translation.activate('en-US')
def tearDown(self):
super(TranslationTestCase, self).tearDown()
settings.REDIRECT_URL = self.redirect_url
settings.REDIRECT_SECRET_KEY = self.redirect_secret_key
super(TranslationTestCase, self).tearDown()
def test_meta_translated_fields(self):
assert not hasattr(UntranslatedModel._meta, 'translated_fields')

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

@ -23,6 +23,7 @@ class UserFormBase(amo.tests.TestCase):
fixtures = ['users/test_backends']
def setUp(self):
super(UserFormBase, self).setUp()
self.user = self.user_profile = UserProfile.objects.get(id='4043307')
self.uidb64 = urlsafe_base64_encode(str(self.user.id))
self.token = default_token_generator.make_token(self.user)

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

@ -105,6 +105,7 @@ def test_user_link_unicode():
class TestAddonUsersList(TestPersonas, amo.tests.TestCase):
def setUp(self):
super(TestAddonUsersList, self).setUp()
self.addon = Addon.objects.get(id=15663)
self.persona = self.addon.persona
self.create_addon_user(self.addon)

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

@ -350,10 +350,12 @@ class TestFlushURLs(amo.tests.TestCase):
fixtures = ['base/user_2519']
def setUp(self):
super(TestFlushURLs, self).setUp()
_connect()
def tearDown(self):
_disconnect()
super(TestFlushURLs, self).tearDown()
@patch('amo.tasks.flush_front_end_cache_urls.apply_async')
def test_flush(self, flush):

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

@ -56,6 +56,7 @@ class UserViewBase(amo.tests.TestCase):
fixtures = ['users/test_backends']
def setUp(self):
super(UserViewBase, self).setUp()
self.client = amo.tests.TestClient()
self.client.get('/')
self.user = UserProfile.objects.get(id='4043307')
@ -293,6 +294,7 @@ class TestEditAdmin(UserViewBase):
fixtures = ['base/users']
def setUp(self):
super(TestEditAdmin, self).setUp()
self.client.login(username='admin@mozilla.com', password='password')
self.regular = self.get_user()
self.url = reverse('users.admin_edit', args=[self.regular.pk])
@ -388,6 +390,7 @@ class TestPasswordAdmin(UserViewBase):
fixtures = ['base/users']
def setUp(self):
super(TestPasswordAdmin, self).setUp()
self.client.login(username='editor@mozilla.com', password='password')
self.url = reverse('users.edit')
self.correct = {'username': 'editor',
@ -950,6 +953,7 @@ class TestUnsubscribe(UserViewBase):
fixtures = ['base/users']
def setUp(self):
super(TestUnsubscribe, self).setUp()
self.user = UserProfile.objects.get(email='editor@mozilla.com')
def test_correct_url_update_notification(self):
@ -1021,6 +1025,7 @@ class TestReset(UserViewBase):
fixtures = ['base/users']
def setUp(self):
super(TestReset, self).setUp()
user = UserProfile.objects.get(email='editor@mozilla.com')
self.token = [urlsafe_base64_encode(str(user.id)),
default_token_generator.make_token(user)]
@ -1128,6 +1133,7 @@ class TestRegistration(UserViewBase):
class TestProfileView(UserViewBase):
def setUp(self):
super(TestProfileView, self).setUp()
self.user = UserProfile.objects.create(homepage='http://example.com')
self.url = reverse('users.profile', args=[self.user.id])
@ -1203,6 +1209,7 @@ class TestProfileSections(amo.tests.TestCase):
'reviews/dev-reply']
def setUp(self):
super(TestProfileSections, self).setUp()
self.user = UserProfile.objects.get(id=10482)
self.url = reverse('users.profile', args=[self.user.id])
@ -1413,6 +1420,7 @@ class TestThemesProfile(amo.tests.TestCase):
fixtures = ['base/user_2519']
def setUp(self):
super(TestThemesProfile, self).setUp()
self.user = UserProfile.objects.get(pk=2519)
self.url = self.user.get_user_url('themes')
@ -1475,6 +1483,7 @@ class TestReportAbuse(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestReportAbuse, self).setUp()
self.full_page = reverse('users.abuse', args=[10482])
@patch('captcha.fields.ReCaptchaField.clean')

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

@ -427,12 +427,14 @@ class TestViews(amo.tests.TestCase):
fixtures = ['addons/eula+contrib-addon']
def setUp(self):
super(TestViews, self).setUp()
self.old_perpage = views.PER_PAGE
views.PER_PAGE = 1
self.addon = Addon.objects.get(id=11730)
def tearDown(self):
views.PER_PAGE = self.old_perpage
super(TestViews, self).tearDown()
def test_version_detail(self):
base = '/en-US/firefox/addon/%s/versions/' % self.addon.slug
@ -483,6 +485,7 @@ class TestFeeds(amo.tests.TestCase):
rel_ns = {'atom': 'http://www.w3.org/2005/Atom'}
def setUp(self):
super(TestFeeds, self).setUp()
patcher = mock.patch.object(feeds, 'PER_PAGE', 1)
patcher.start()
self.addCleanup(patcher.stop)
@ -564,6 +567,7 @@ class TestDownloadsBase(amo.tests.TestCase):
fixtures = ['base/addon_5299_gcal', 'base/users']
def setUp(self):
super(TestDownloadsBase, self).setUp()
self.addon = Addon.objects.get(id=5299)
self.file = File.objects.get(id=33046)
self.beta_file = File.objects.get(id=64874)
@ -786,6 +790,7 @@ class TestDownloadSource(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/admin', ]
def setUp(self):
super(TestDownloadSource, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.version = self.addon._latest_version
tdir = temp.gettempdir()
@ -1007,6 +1012,7 @@ class TestMobileVersions(TestMobile):
class TestApplicationsVersions(amo.tests.TestCase):
def setUp(self):
super(TestApplicationsVersions, self).setUp()
self.version_kw = dict(min_app_version='5.0', max_app_version='6.*')
def test_repr_when_compatible(self):

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

@ -66,6 +66,7 @@ class TestLangpackFetcher(amo.tests.TestCase):
LISTING = 'pretend-this-is-a-sha256-sum win32/xpi/de-DE.xpi\n'
def setUp(self):
super(TestLangpackFetcher, self).setUp()
request_patch = mock.patch('zadmin.tasks.requests.get')
self.mock_request = request_patch.start()
self.addCleanup(request_patch.stop)

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

@ -48,6 +48,7 @@ class TestSiteEvents(amo.tests.TestCase):
fixtures = ['base/users', 'zadmin/tests/siteevents']
def setUp(self):
super(TestSiteEvents, self).setUp()
self.client.login(username='admin@mozilla.com', password='password')
def test_get(self):
@ -147,6 +148,7 @@ class BulkValidationTest(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/appversion', 'base/users']
def setUp(self):
super(BulkValidationTest, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
self.addon = Addon.objects.get(pk=3615)
@ -167,6 +169,7 @@ class BulkValidationTest(amo.tests.TestCase):
def tearDown(self):
settings.TASK_USER_ID = self.old_task_user
super(BulkValidationTest, self).tearDown()
def appversion(self, version, application=amo.FIREFOX.id):
return AppVersion.objects.get(application=application,
@ -1119,6 +1122,7 @@ class TestEmailPreview(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestEmailPreview, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
addon = Addon.objects.get(pk=3615)
@ -1141,6 +1145,7 @@ class TestMonthlyPick(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestMonthlyPick, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
self.url = reverse('zadmin.monthly_pick')
@ -1215,6 +1220,7 @@ class TestFeatures(amo.tests.TestCase):
fixtures = ['base/users', 'base/collections', 'base/addon_3615.json']
def setUp(self):
super(TestFeatures, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
self.url = reverse('zadmin.features')
@ -1326,6 +1332,7 @@ class TestOAuth(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestOAuth, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
@ -1341,6 +1348,7 @@ class TestLookup(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestLookup, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
self.user = UserProfile.objects.get(pk=999)
@ -1392,6 +1400,7 @@ class TestAddonSearch(amo.tests.ESTestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestAddonSearch, self).setUp()
self.reindex(Addon)
assert self.client.login(username='admin@mozilla.com',
password='password')
@ -1407,6 +1416,7 @@ class TestAddonAdmin(amo.tests.TestCase):
fixtures = ['base/users', 'base/addon_3615']
def setUp(self):
super(TestAddonAdmin, self).setUp()
assert self.client.login(username='admin@mozilla.com',
password='password')
self.url = reverse('admin:addons_addon_changelist')
@ -1424,6 +1434,7 @@ class TestAddonManagement(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestAddonManagement, self).setUp()
self.addon = Addon.objects.get(pk=3615)
self.url = reverse('zadmin.addon_manage', args=[self.addon.slug])
self.client.login(username='admin@mozilla.com', password='password')
@ -1488,6 +1499,7 @@ class TestJetpack(amo.tests.TestCase):
fixtures = ['base/users']
def setUp(self):
super(TestJetpack, self).setUp()
self.url = reverse('zadmin.jetpack')
self.client.login(username='admin@mozilla.com', password='password')
@ -1603,6 +1615,7 @@ class TestCompat(amo.tests.ESTestCase):
fixtures = ['base/users']
def setUp(self):
super(TestCompat, self).setUp()
self.url = reverse('zadmin.compat')
self.client.login(username='admin@mozilla.com', password='password')
self.app = amo.FIREFOX
@ -1774,6 +1787,7 @@ class TestMemcache(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestMemcache, self).setUp()
self.url = reverse('zadmin.memcache')
cache.set('foo', 'bar')
self.client.login(username='admin@mozilla.com', password='password')
@ -1795,6 +1809,7 @@ class TestElastic(amo.tests.ESTestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestElastic, self).setUp()
self.url = reverse('zadmin.elastic')
self.client.login(username='admin@mozilla.com', password='password')
@ -1809,6 +1824,7 @@ class TestEmailDevs(amo.tests.TestCase):
fixtures = ['base/addon_3615', 'base/users']
def setUp(self):
super(TestEmailDevs, self).setUp()
self.login('admin')
self.addon = Addon.objects.get(pk=3615)

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

@ -45,6 +45,7 @@ class TestHekaStdLibLogging(amo.tests.TestCase):
"""
def setUp(self):
super(TestHekaStdLibLogging, self).setUp()
HEKA_CONF = {
'encoder': 'heka.encoders.StdlibPayloadEncoder',
'stream': {
@ -67,6 +68,7 @@ class TestHekaStdLibLogging(amo.tests.TestCase):
def tearDown(self):
self.logger.handlers = self._orig_handlers
super(TestHekaStdLibLogging, self).tearDown()
def test_oldstyle_sends_msg(self):
msg = 'an error'
@ -109,6 +111,7 @@ class TestRaven(amo.tests.TestCase):
We need to set the settings.HEKA instance to use a
DebugCaptureStream so that we can inspect the sent messages.
"""
super(TestRaven, self).setUp()
heka = settings.HEKA
HEKA_CONF = {

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

@ -60,6 +60,7 @@ TOTEM_INFO_HAS_AUDIO=False
class TestFFmpegVideo(amo.tests.TestCase):
def setUp(self):
super(TestFFmpegVideo, self).setUp()
self.video = ffmpeg.Video(files['good'])
if not ffmpeg.Video.library_available():
raise SkipTest
@ -105,6 +106,7 @@ class TestFFmpegVideo(amo.tests.TestCase):
class TestBadFFmpegVideo(amo.tests.TestCase):
def setUp(self):
super(TestBadFFmpegVideo, self).setUp()
self.video = ffmpeg.Video(files['bad'])
if not self.video.library_available():
raise SkipTest
@ -129,6 +131,7 @@ class TestBadFFmpegVideo(amo.tests.TestCase):
class TestTotemVideo(amo.tests.TestCase):
def setUp(self):
super(TestTotemVideo, self).setUp()
self.video = totem.Video(files['good'])
self.video._call_indexer = Mock()
@ -189,6 +192,7 @@ class TestTask(amo.tests.TestCase):
# up all the time.
def setUp(self):
super(TestTask, self).setUp()
waffle.models.Switch.objects.create(name='video-encode', active=True)
self.mock = Mock()
self.mock.thumbnail_path = tempfile.mkstemp()[1]