removing remove_extra_cats tests
This commit is contained in:
Родитель
778618f27c
Коммит
1e59c5aacf
|
@ -4,7 +4,7 @@ from nose.tools import eq_
|
|||
import test_utils
|
||||
|
||||
import amo
|
||||
from amo.cron import gc, remove_extra_cats
|
||||
from amo.cron import gc
|
||||
from addons.models import Addon, AddonCategory, Category
|
||||
from bandwagon.models import Collection
|
||||
from cake.models import Session
|
||||
|
@ -40,44 +40,3 @@ class GarbageTest(test_utils.TestCase):
|
|||
assert Addon.objects.filter(status=0, highest_status=0)
|
||||
gc()
|
||||
assert not Addon.objects.filter(status=0, highest_status=0)
|
||||
|
||||
|
||||
class RemoveExtraCatTest(test_utils.TestCase):
|
||||
fixtures = ['base/category']
|
||||
|
||||
def setUp(self):
|
||||
self.misc = Category.objects.create(misc=True, name='misc',
|
||||
type=amo.ADDON_EXTENSION,
|
||||
application_id=amo.FIREFOX.id)
|
||||
self.regular = []
|
||||
for i in xrange(3):
|
||||
self.regular.append(Category.objects.create(
|
||||
name='normal_%d' % i, application_id=amo.FIREFOX.id,
|
||||
type=amo.ADDON_EXTENSION))
|
||||
self.addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
|
||||
|
||||
def test_remove_others(self):
|
||||
eq_(self.addon.categories.count(), 0)
|
||||
AddonCategory.objects.create(addon=self.addon, category=self.misc)
|
||||
AddonCategory.objects.create(addon=self.addon,
|
||||
category=self.regular[0])
|
||||
eq_(self.addon.categories.count(), 2)
|
||||
remove_extra_cats()
|
||||
eq_(self.addon.categories.count(), 1)
|
||||
eq_(unicode(self.addon.categories.get().name), 'normal_0')
|
||||
|
||||
def test_remove_extras(self):
|
||||
eq_(self.addon.categories.count(), 0)
|
||||
for cat in self.regular:
|
||||
AddonCategory.objects.create(addon=self.addon, category=cat)
|
||||
eq_(self.addon.categories.count(), 3)
|
||||
remove_extra_cats()
|
||||
eq_(self.addon.categories.count(), 2)
|
||||
|
||||
def test_noop(self):
|
||||
eq_(self.addon.categories.count(), 0)
|
||||
for cat in self.regular[:2]:
|
||||
AddonCategory.objects.create(addon=self.addon, category=cat)
|
||||
eq_(self.addon.categories.count(), 2)
|
||||
remove_extra_cats()
|
||||
eq_(self.addon.categories.count(), 2)
|
||||
|
|
Загрузка…
Ссылка в новой задаче