add logging to update status (but 609910)
This commit is contained in:
Родитель
c9f3224f57
Коммит
4eb1760c32
|
@ -465,6 +465,9 @@ class Addon(amo.models.ModelBase):
|
|||
elif not (self.versions.using(using)
|
||||
.filter(files__status=amo.STATUS_PUBLIC).exists()):
|
||||
self.update(status=amo.STATUS_UNREVIEWED)
|
||||
else:
|
||||
return
|
||||
amo.log(amo.LOG.CHANGE_STATUS, self.get_status_display(), self)
|
||||
|
||||
@staticmethod
|
||||
def transformer(addons):
|
||||
|
|
|
@ -10,12 +10,14 @@ from nose.tools import eq_, assert_not_equal
|
|||
import test_utils
|
||||
|
||||
import amo
|
||||
from amo import set_user
|
||||
from amo.signals import _connect, _disconnect
|
||||
from addons.models import (Addon, AddonDependency, AddonPledge,
|
||||
AddonRecommendation, AddonType, Category, Feature,
|
||||
Persona, Preview)
|
||||
from files.models import File
|
||||
from applications.models import Application, AppVersion
|
||||
from devhub.models import ActivityLog
|
||||
from files.models import File
|
||||
from reviews.models import Review
|
||||
from users.models import UserProfile
|
||||
from versions.models import ApplicationsVersions, Version
|
||||
|
@ -316,6 +318,14 @@ class TestAddonModels(test_utils.TestCase):
|
|||
a.status = amo.STATUS_UNREVIEWED
|
||||
assert not a.show_beta
|
||||
|
||||
def test_update_logs(self):
|
||||
addon = Addon.objects.get(id=3615)
|
||||
set_user(UserProfile.objects.all()[0])
|
||||
addon.versions.all().delete()
|
||||
|
||||
entries = ActivityLog.objects.all()
|
||||
eq_(entries[0].action, amo.LOG.CHANGE_STATUS.id)
|
||||
|
||||
|
||||
class TestCategoryModel(test_utils.TestCase):
|
||||
|
||||
|
|
|
@ -1863,8 +1863,8 @@ class TestVersionEditFiles(TestVersionEdit):
|
|||
eq_(ActivityLog.objects.count(), 0)
|
||||
r = self.client.post(self.url, self.formset(*forms, prefix='files'))
|
||||
|
||||
eq_(ActivityLog.objects.count(), 1)
|
||||
log = ActivityLog.objects.all()[0]
|
||||
eq_(ActivityLog.objects.count(), 2)
|
||||
log = ActivityLog.objects.all()[1]
|
||||
eq_(log.to_string(), u'File delicious_bookmarks-2.1.072-fx.xpi '
|
||||
'deleted from <a href="/en-US/firefox/addon/3615'
|
||||
'/versions/2.1.072">Version 2.1.072</a> of <a '
|
||||
|
|
Загрузка…
Ссылка в новой задаче