コード例 #1
0
 def _check_result(self, static_theme, authors, tags, categories, license_,
                   ratings):
     # metadata is correct
     assert list(static_theme.authors.all()) == authors
     assert list(static_theme.tags.all()) == tags
     assert len(categories) == 1
     lwt_cat = categories[0]
     static_theme_cats = [(cat.name, cat.application)
                          for cat in static_theme.all_categories]
     assert static_theme_cats == [(lwt_cat.name, amo.FIREFOX.id),
                                  (lwt_cat.name, amo.ANDROID.id)]
     assert static_theme.current_version.license.builtin == license_
     # status is good
     assert static_theme.status == amo.STATUS_PUBLIC
     current_file = static_theme.current_version.files.get()
     assert current_file.status == amo.STATUS_PUBLIC
     # Ratings were migrated
     assert list(Rating.unfiltered.filter(addon=static_theme)) == ratings
     log_entries = ActivityLog.objects.filter(action=amo.LOG.ADD_RATING.id,
                                              addonlog__addon=static_theme)
     assert log_entries.count() == len(ratings)
     for rating, log_entry in zip(ratings, log_entries):
         arguments = log_entry.arguments
         assert rating in arguments
         assert static_theme in arguments
     # UpdateCounts were copied.
     assert UpdateCount.objects.filter(
         addon_id=static_theme.id).count() == 2
     # xpi was signed
     self.call_signing_mock.assert_called_with(current_file)
     assert current_file.cert_serial_num == 'abcdefg1234'
     assert static_theme.created == self.create_date
     assert static_theme.modified == self.modify_date
     cron.addon_last_updated()  # Make sure the last_updated change stuck.
     assert static_theme.reload().last_updated == self.update_date
コード例 #2
0
ファイル: test_cron.py プロジェクト: aelawson/addons-server
 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)
     assert addon.last_updated == addon.created
     assert addon.last_updated
コード例 #3
0
 def _check_result(self, static_theme, authors, tags, categories, license_,
                   ratings):
     # metadata is correct
     assert list(static_theme.authors.all()) == authors
     assert list(static_theme.tags.all()) == tags
     assert [cat.name for cat in static_theme.all_categories] == [
         cat.name for cat in categories]
     assert static_theme.current_version.license.builtin == license_
     # status is good
     assert static_theme.status == amo.STATUS_PUBLIC
     current_file = static_theme.current_version.files.get()
     assert current_file.status == amo.STATUS_PUBLIC
     # Ratings were migrated
     assert list(Rating.unfiltered.filter(addon=static_theme)) == ratings
     log_entries = ActivityLog.objects.filter(
         action=amo.LOG.ADD_RATING.id, addonlog__addon=static_theme)
     assert log_entries.count() == len(ratings)
     for rating, log_entry in zip(ratings, log_entries):
         arguments = log_entry.arguments
         assert rating in arguments
         assert static_theme in arguments
     # UpdateCounts were copied.
     assert UpdateCount.objects.filter(
         addon_id=static_theme.id).count() == 2
     # xpi was signed
     self.call_signing_mock.assert_called_with(current_file)
     assert current_file.cert_serial_num == 'abcdefg1234'
     assert static_theme.created == self.create_date
     assert static_theme.modified == self.modify_date
     cron.addon_last_updated()  # Make sure the last_updated change stuck.
     assert static_theme.reload().last_updated == self.update_date
コード例 #4
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
コード例 #5
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():
            assert addon.last_updated == addon.created

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.all():
            assert addon.last_updated == addon.created
コード例 #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():
            assert addon.last_updated == addon.created

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.all():
            assert addon.last_updated == addon.created
コード例 #7
0
ファイル: test_cron.py プロジェクト: aelawson/addons-server
 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)
     assert len(files) == 1
     assert addon.last_updated == files[0].datestatuschanged
     assert addon.last_updated
コード例 #8
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
コード例 #9
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_APPROVED)
         .update(datestatuschanged=None))
        Addon.objects.update(last_updated=None)

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

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_APPROVED):
            assert addon.last_updated == addon.created
コード例 #10
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):
            assert addon.last_updated == addon.created

        # Make sure it's stable.
        cron.addon_last_updated()
        for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC):
            assert addon.last_updated == addon.created
コード例 #11
0
ファイル: test_tasks.py プロジェクト: diox/olympia
 def _check_result(self, static_theme, authors, tags, categories, license_,
                   ratings, collection):
     # metadata is correct
     assert list(static_theme.authors.all()) == authors
     assert list(static_theme.tags.all()) == tags
     assert len(categories) == 1
     lwt_cat = categories[0]
     static_theme_cats = [
         (cat.name, cat.application) for cat in static_theme.all_categories]
     assert static_theme_cats == [
         (lwt_cat.name, amo.FIREFOX.id), (lwt_cat.name, amo.ANDROID.id)]
     assert static_theme.current_version.license.builtin == license_
     # status is good
     assert static_theme.status == amo.STATUS_APPROVED
     current_file = static_theme.current_version.files.get()
     assert current_file.status == amo.STATUS_APPROVED
     # Ratings were migrated
     assert list(Rating.unfiltered.filter(addon=static_theme)) == ratings
     log_entries = ActivityLog.objects.filter(
         action=amo.LOG.ADD_RATING.id, addonlog__addon=static_theme)
     assert log_entries.count() == len(ratings)
     for rating, log_entry in zip(ratings, log_entries):
         arguments = log_entry.arguments
         assert rating in arguments
         assert static_theme in arguments
     # The collection has the new theme
     if collection:
         assert static_theme in list(collection.addons.all())
         assert collection.addons.filter(
             type=amo.ADDON_PERSONA).count() == 0
         assert collection.addons.filter(
             type=amo.ADDON_STATICTHEME).count() == 1
         assert collection.addons.count() == 2
     # UpdateCounts were copied.
     assert UpdateCount.objects.filter(
         addon_id=static_theme.id).count() == 2
     # xpi was signed
     self.call_signing_mock.assert_called_with(current_file)
     assert current_file.cert_serial_num == 'abcdefg1234'
     assert static_theme.created == self.create_date
     assert static_theme.modified == self.modify_date
     cron.addon_last_updated()  # Make sure the last_updated change stuck.
     assert static_theme.reload().last_updated == self.update_date