Skip to content

Commit

Permalink
detect beta files (bug 619157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Dec 28, 2010
1 parent 72973bd commit daeb6f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Binary file added apps/files/fixtures/files/beta-extension.xpi
Binary file not shown.
2 changes: 2 additions & 0 deletions apps/files/models.py
Expand Up @@ -91,6 +91,8 @@ def from_upload(cls, upload, version, platform, parse_data={}):
f.jetpack = cls.is_jetpack(upload.path)
f.hash = upload.hash
f.no_restart = parse_data.get('no_restart', False)
if amo.VERSION_BETA.search(parse_data.get('version', '')):
f.status = amo.STATUS_BETA
f.save()
log.debug('New file: %r from %r' % (f, upload))
# Move the uploaded file from the temp location.
Expand Down
6 changes: 6 additions & 0 deletions apps/files/tests.py
Expand Up @@ -387,6 +387,12 @@ def test_size_small(self):
f = File.from_upload(upload, self.version, self.platform)
eq_(f.size, 1)

def test_beta_version(self):
upload = self.upload('beta-extension')
data = parse_addon(upload.path)
f = File.from_upload(upload, self.version, self.platform, data)
eq_(f.status, amo.STATUS_BETA)


class TestZip(test_utils.TestCase):

Expand Down

0 comments on commit daeb6f8

Please sign in to comment.