Esempio n. 1
0
 def test_last_update_lite_no_files(self):
     Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
     File.objects.update(status=amo.STATUS_UNREVIEWED)
     cron.addon_last_updated()
     addon = Addon.objects.get(id=3615)
     eq_(addon.last_updated, addon.created)
     assert addon.last_updated
Esempio n. 2
0
 def test_last_update_lite_no_files(self):
     Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
     File.objects.update(status=amo.STATUS_UNREVIEWED)
     cron.addon_last_updated()
     addon = Addon.objects.get(id=3615)
     eq_(addon.last_updated, addon.created)
     assert addon.last_updated
Esempio n. 3
0
 def test_last_updated_lite(self):
     # Make sure lite addons' last_updated matches their file's
     # datestatuschanged.
     Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
     File.objects.update(status=amo.STATUS_LITE)
     cron.addon_last_updated()
     addon = Addon.objects.get(id=3615)
     files = File.objects.filter(version__addon=addon)
     eq_(len(files), 1)
     eq_(addon.last_updated, files[0].datestatuschanged)
     assert addon.last_updated
Esempio n. 4
0
    def test_personas(self):
        Addon.objects.update(type=amo.ADDON_PERSONA, status=amo.STATUS_PUBLIC)

        cron.addon_last_updated()
        for addon in Addon.objects.all():
            eq_(addon.last_updated, addon.created)

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.all():
            eq_(addon.last_updated, addon.created)
Esempio n. 5
0
 def test_last_updated_lite(self):
     # Make sure lite addons' last_updated matches their file's
     # datestatuschanged.
     Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
     File.objects.update(status=amo.STATUS_LITE)
     cron.addon_last_updated()
     addon = Addon.objects.get(id=3615)
     files = File.objects.filter(version__addon=addon)
     eq_(len(files), 1)
     eq_(addon.last_updated, files[0].datestatuschanged)
     assert addon.last_updated
Esempio n. 6
0
    def test_personas(self):
        Addon.objects.update(type=amo.ADDON_PERSONA, status=amo.STATUS_PUBLIC)

        cron.addon_last_updated()
        for addon in Addon.objects.all():
            eq_(addon.last_updated, addon.created)

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.all():
            eq_(addon.last_updated, addon.created)
Esempio n. 7
0
    def test_catchall(self):
        """Make sure the catch-all last_updated is stable and accurate."""
        # Nullify all datestatuschanged so the public add-ons hit the
        # catch-all.
        (File.objects.filter(status=amo.STATUS_PUBLIC).update(datestatuschanged=None))
        Addon.objects.update(last_updated=None)

        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC, type=amo.ADDON_EXTENSION):
            eq_(addon.last_updated, addon.created)

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC):
            eq_(addon.last_updated, addon.created)
Esempio n. 8
0
    def test_catchall(self):
        """Make sure the catch-all last_updated is stable and accurate."""
        # Nullify all datestatuschanged so the public add-ons hit the
        # catch-all.
        (File.objects.filter(status=amo.STATUS_PUBLIC).update(
            datestatuschanged=None))
        Addon.objects.update(last_updated=None)

        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC,
                                          type=amo.ADDON_EXTENSION):
            eq_(addon.last_updated, addon.created)

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC):
            eq_(addon.last_updated, addon.created)