Beispiel #1
0
    def create_blocklisted_version(self):
        """
        Creates a new version who's file is the blocklisted app found in /media
        and sets status to STATUS_BLOCKLISTED.

        """
        blocklisted_path = os.path.join(settings.MEDIA_ROOT, 'packaged-apps',
                                        'blocklisted.zip')
        last_version = self.current_version.version
        v = Version.objects.create(
            addon=self, version='blocklisted-%s' % last_version)
        f = File(version=v, status=amo.STATUS_BLOCKED,
                 platform=Platform.objects.get(id=amo.PLATFORM_ALL.id))
        f.filename = f.generate_filename()
        copy_stored_file(blocklisted_path, f.file_path)
        log.info(u'[Webapp:%s] Copied blocklisted app from %s to %s' % (
            self.id, blocklisted_path, f.file_path))
        f.size = storage.size(f.file_path)
        f.hash = f.generate_hash(f.file_path)
        f.save()
        f.inject_ids()
        self.sign_if_packaged(v.pk)
        self.status = amo.STATUS_BLOCKED
        self._current_version = v
        self.save()
Beispiel #2
0
    def create_blocklisted_version(self):
        """
        Creates a new version who's file is the blocklisted app found in /media
        and sets status to STATUS_BLOCKLISTED.

        """
        blocklisted_path = os.path.join(settings.MEDIA_ROOT, 'packaged-apps',
                                        'blocklisted.zip')
        last_version = self.current_version.version
        v = Version.objects.create(addon=self,
                                   version='blocklisted-%s' % last_version)
        f = File(version=v,
                 status=amo.STATUS_BLOCKED,
                 platform=Platform.objects.get(id=amo.PLATFORM_ALL.id))
        f.filename = f.generate_filename()
        copy_stored_file(blocklisted_path, f.file_path)
        log.info(u'[Webapp:%s] Copied blocklisted app from %s to %s' %
                 (self.id, blocklisted_path, f.file_path))
        f.size = storage.size(f.file_path)
        f.hash = f.generate_hash(f.file_path)
        f.save()
        f.inject_ids()
        self.sign_if_packaged(v.pk)
        self.status = amo.STATUS_BLOCKED
        self._current_version = v
        self.save()
Beispiel #3
0
 def test_generate_hash(self):
     f = File()
     f.version = Version.objects.get(pk=81551)
     fn = self.xpi_path('delicious_bookmarks-2.1.106-fx')
     assert f.generate_hash(fn).startswith('sha256:fd277d45ab44f6240e')
Beispiel #4
0
 def test_generate_hash(self):
     f = File()
     f.version = Version.objects.get(pk=81551)
     fn = self.xpi_path('delicious_bookmarks-2.1.106-fx')
     assert f.generate_hash(fn).startswith('sha256:fd277d45ab44f6240e')
Beispiel #5
0
 def test_generate_hash(self):
     f = File()
     f.version = Version.objects.get()
     fn = self.packaged_app_path('mozball.zip')
     assert f.generate_hash(fn).startswith('sha256:ad85d6316166d4')
Beispiel #6
0
 def test_generate_hash(self):
     f = File()
     f.version = Version.objects.get()
     fn = self.packaged_app_path('mozball.zip')
     assert f.generate_hash(fn).startswith('sha256:ad85d6316166d4')