コード例 #1
0
    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())
コード例 #2
0
ファイル: test_package.py プロジェクト: mete0r/pyhwp
    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())
コード例 #3
0
    def test_build_minimal(self):
        from oxt_tool.package import build

        manifest = Manifest()
        description = Description()
        oxt_path = self.id() + '.oxt'
        build(oxt_path, manifest, description)
        with open_storage(oxt_path) as pkg:
            self.assertTrue(is_package(pkg))
コード例 #4
0
ファイル: test_package.py プロジェクト: mete0r/pyhwp
    def test_build_minimal(self):
        from oxt_tool.package import build

        manifest = Manifest()
        description = Description()
        oxt_path = self.id() + '.oxt'
        build(oxt_path, manifest, description)
        with open_storage(oxt_path) as pkg:
            self.assertTrue(is_package(pkg))
コード例 #5
0
    def test_build_missing(self):
        from oxt_tool.package import build

        oxt_path = self.id() + '.oxt'

        manifest = Manifest()
        description = Description(license=dict(en='COPYING'))
        files = dict()
        try:
            build(oxt_path, manifest, description, files=files)
            assert False, 'exception expected'
        except Exception:
            pass
コード例 #6
0
ファイル: test_package.py プロジェクト: mete0r/pyhwp
    def test_build_missing(self):
        from oxt_tool.package import build

        oxt_path = self.id() + '.oxt'

        manifest = Manifest()
        description = Description(license=dict(en='COPYING'))
        files = dict()
        try:
            build(oxt_path, manifest, description, files=files)
            assert False, 'exception expected'
        except Exception:
            pass