def test_build_typical(self): from oxt_tool.package import build from oxt_tool.storage import makedirs_to_file manifest = Manifest() description = Description() import os.path import shutil src_folder_path = self.id() if os.path.exists(src_folder_path): shutil.rmtree(src_folder_path) src_folder = FileSystemStorage(src_folder_path, 'w') license_path = 'COPYING' license_node = makedirs_to_file(src_folder, license_path) with license_node.open('w') as f: f.write('GNU AGPL') description.license['en'] = license_path oxt_path = self.id() + '.oxt' files = {license_path: license_node} build(oxt_path, manifest, description, files=files) with open_storage(oxt_path) as pkg: with resolve_path(pkg, 'COPYING').open() as f: self.assertEquals('GNU AGPL', f.read())
def test_build_typical(self): from oxt_tool.package import build from oxt_tool.storage import makedirs_to_file manifest = Manifest() description = Description() import os.path import shutil src_folder_path = self.id() if os.path.exists(src_folder_path): shutil.rmtree(src_folder_path) src_folder = FileSystemStorage(src_folder_path, 'w') license_path = 'COPYING' license_node = makedirs_to_file(src_folder, license_path) with license_node.open('w') as f: f.write('GNU AGPL') description.license['en'] = license_path oxt_path = self.id() + '.oxt' files = {license_path: license_node} build(oxt_path, manifest, description, files=files) with open_storage(oxt_path) as pkg: with resolve_path(pkg, 'COPYING').open() as f: self.assertEqual('GNU AGPL', f.read())
def test_makedirs_to_file(self): import os.path path = os.path.join('hello', 'world', 'makedirs') with self.create_fixture_folder() as folder: node = makedirs_to_file(folder, path) with node.open('w'): pass with self.get_fixture_folder() as folder: node = resolve_path(folder, path) self.assertTrue(node is not None)