set the file hash from the FileUpload
This commit is contained in:
Родитель
42de38f8e6
Коммит
43910d0944
|
@ -87,10 +87,9 @@ class File(amo.models.ModelBase):
|
|||
f.filename = f.generate_filename(extension=upload.path.ext)
|
||||
f.size = upload.path.size
|
||||
f.jetpack = cls.is_jetpack(upload.path)
|
||||
# TODO: f.hash = upload.hash
|
||||
f.hash = upload.hash
|
||||
f.save()
|
||||
log.debug('New file: %r from %r' % (f, upload))
|
||||
# Detect addon-sdk-built addons.
|
||||
# Move the uploaded file from the temp location.
|
||||
dest = path.path(version.path_prefix)
|
||||
if not dest.exists():
|
||||
|
|
|
@ -341,6 +341,11 @@ class TestFileFromUpload(UploadTest):
|
|||
eq_(fv.warnings, 1)
|
||||
eq_(fv.notices, 2)
|
||||
|
||||
def test_file_hash(self):
|
||||
upload = self.upload('jetpack')
|
||||
f = File.from_upload(upload, self.version, self.platform)
|
||||
eq_(f.hash, upload.hash)
|
||||
|
||||
|
||||
class TestZip(test_utils.TestCase):
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче