TI Do Not Know about celery
This commit is contained in:
Родитель
96488bb1d4
Коммит
8c8914a050
|
@ -142,7 +142,7 @@ locales = ['en-US']
|
|||
|
||||
|
||||
@task
|
||||
def refresh_mdn_cache(refresh=True, **kw):
|
||||
def refresh_mdn_cache(**kw):
|
||||
log.info('Refreshing MDN Cache')
|
||||
try:
|
||||
_update_mdn_items(tutorials)
|
||||
|
|
|
@ -38,19 +38,19 @@ class TestLanding(amo.tests.TestCase):
|
|||
@mock.patch('mkt.ecosystem.views.refresh_mdn_cache')
|
||||
def test_tutorials_refresh(self, mock_):
|
||||
r = self.client.get(self.url)
|
||||
assert not mock_.delay.called
|
||||
assert not mock_.called
|
||||
|
||||
r = self.client.get(self.url, {'refresh': '1'})
|
||||
assert mock_.delay.called
|
||||
assert mock_.called
|
||||
|
||||
@mock.patch.object(settings, 'MDN_LAZY_REFRESH', False)
|
||||
@mock.patch('mkt.ecosystem.views.refresh_mdn_cache')
|
||||
def test_tutorials_refresh_disabled(self, mock_):
|
||||
r = self.client.get(self.url)
|
||||
assert not mock_.delay.called
|
||||
assert not mock_.called
|
||||
|
||||
r = self.client.get(self.url, {'refresh': '1'})
|
||||
assert not mock_.delay.called
|
||||
assert not mock_.called
|
||||
|
||||
|
||||
class TestDevHub(amo.tests.TestCase):
|
||||
|
|
|
@ -16,8 +16,8 @@ log = commonware.log.getLogger('z.ecosystem')
|
|||
|
||||
def _refresh_mdn(request):
|
||||
if settings.MDN_LAZY_REFRESH and 'refresh' in request.GET:
|
||||
# So I guess arguments are required for celery tasks. Sheesh.
|
||||
refresh_mdn_cache.delay(True)
|
||||
# If you can delay this, please teach me. I give up.
|
||||
refresh_mdn_cache()
|
||||
messages.success(request,
|
||||
'Pulling new content from MDN. Please check back in a few minutes.'
|
||||
' Thanks for all your awesome work! Devs appreciate it!')
|
||||
|
|
Загрузка…
Ссылка в новой задаче