I don't know what the hell I was thinking

This commit is contained in:
Jeff Balogh 2010-12-14 13:46:12 -08:00
Родитель 43910d0944
Коммит 15085c96e3
4 изменённых файлов: 11 добавлений и 17 удалений

Просмотреть файл

@ -707,10 +707,6 @@ class TestAddonFromUpload(files.tests.UploadTest):
for version in ('3.0', '3.6.*'):
AppVersion.objects.create(application_id=1, version=version)
def get_upload(self, filename):
d = open(self.file_path(filename)).read()
return FileUpload.from_post([d], filename=filename, size=1234)
def test_xpi_attributes(self):
addon = Addon.from_upload(self.get_upload('extension.xpi'),
self.platform)

Просмотреть файл

@ -3036,11 +3036,7 @@ class UploadTest(files.tests.UploadTest, test_utils.TestCase):
def setUp(self):
super(UploadTest, self).setUp()
v = json.dumps(dict(errors=0, warnings=1, notices=2))
xpi = open(self.xpi_path('extension')).read()
self.upload = FileUpload.from_post([xpi], filename='extension.xpi',
size=1234)
self.upload.update(valid=True, validation=v)
self.upload = self.get_upload('extension.xpi')
self.addon = Addon.objects.get(id=3615)
self.version = self.addon.current_version
self.addon.update(guid='guid@xpi')
@ -3136,11 +3132,7 @@ class TestCreateAddon(files.tests.UploadTest, test_utils.TestCase):
def setUp(self):
super(TestCreateAddon, self).setUp()
self._redis = mock_redis()
xpi = open(self.xpi_path('extension')).read()
v = json.dumps(dict(errors=0, warnings=1, notices=2))
self.upload = FileUpload.from_post([xpi], filename='extension.xpi',
size=1234)
self.upload.update(valid=True, validation=v)
self.upload = self.get_upload('extension.xpi')
self.url = reverse('devhub.submit.2')
assert self.client.login(username='regular@mozilla.com',
password='password')

Просмотреть файл

@ -46,6 +46,14 @@ class UploadTest(test_utils.TestCase):
def xpi_path(self, name):
return self.file_path(name + '.xpi')
def get_upload(self, filename, validation=None):
xpi = open(self.file_path(filename)).read()
upload = FileUpload.from_post([xpi], filename=filename, size=1234)
upload.validation = (validation or
json.dumps(dict(errors=0, warnings=1, notices=2)))
upload.save()
return upload
class TestFile(test_utils.TestCase):
"""

Просмотреть файл

@ -423,9 +423,7 @@ class TestVersionFromUpload(files.tests.UploadTest, test_utils.TestCase):
def setUp(self):
super(TestVersionFromUpload, self).setUp()
xpi = open(self.file_path(self.filename)).read()
self.upload = FileUpload.from_post([xpi], filename=self.filename,
size=1234)
self.upload = self.get_upload(self.filename)
self.addon = Addon.objects.get(id=3615)
self.addon.update(guid='guid@xpi')
self.platform = Platform.objects.create(id=amo.PLATFORM_MAC.id)