def test_migrate_versions_extracts_source( self, extract_source_mock, extract_mock): addon = addon_factory(file_kw={'filename': 'webextension_no_id.xpi'}) version_to_migrate = addon.current_version version_to_migrate.update( source=source_upload_path(version_to_migrate, 'foo.tar.gz')) version_without_source = version_factory( addon=addon, file_kw={'filename': 'webextension_no_id.xpi'}) migrate_webextensions_to_git_storage([addon.pk]) extract_source_mock.assert_called_once_with(version_to_migrate.pk) extract_mock.assert_has_calls([ mock.call(version_to_migrate.pk), mock.call(version_without_source.pk) ])
def test_source_upload_path_utf8_chars(self): addon = Addon.objects.get(id=3615) addon.update(slug=u'crosswarpex-확장') version = version_factory(addon=addon, version='0.1') uploaded_name = source_upload_path(version, 'crosswarpex-확장.tar.gz') assert uploaded_name.endswith(u'crosswarpex-확장-0.1-src.tar.gz')
def test_source_upload_path(self): addon = Addon.objects.get(id=3615) version = version_factory(addon=addon, version='0.1') uploaded_name = source_upload_path(version, 'foo.tar.gz') assert uploaded_name.endswith(u'a3615-0.1-src.tar.gz')