Exemplo n.º 1
0
 def setUpClass(cls):
     super(ApplicationTestCase, cls).setUpClass()
     cls.archive_name = "ToUpload"
     cls.alt_archive_name = "ModifiedAfterUpload"
     cls.manifest = os.path.join(consts.PackageDir, 'manifest.yaml')
     cls.archive = utils.compose_package(cls.archive_name, cls.manifest,
                                         consts.PackageDir)
Exemplo n.º 2
0
 def setUpClass(cls):
     super(ApplicationTestCase, cls).setUpClass()
     cls.archive_name = "ToUpload"
     cls.alt_archive_name = "ModifiedAfterUpload"
     cls.manifest = os.path.join(consts.PackageDir, 'manifest.yaml')
     cls.archive = utils.compose_package(cls.archive_name, cls.manifest,
                                         consts.PackageDir)
def prepare_zips():
    def change_archive_size(archive_name, size):
        file_name = os.path.join(os.path.split(archive_name)[0], "file")
        initial_size = os.path.getsize(archive_name)
        with open(file_name, "wb") as f:
            f.seek(size * 1024 * 1024 - initial_size - 1)
            f.write("\0")
        with zipfile.ZipFile(archive_name, "a") as archive:
            archive.write(file_name)

    tmp_dir = tempfile.mkdtemp()
    manifest = os.path.join(c.PackageDir, "manifest.yaml")
    app_small = utils.compose_package(apps_names[0], manifest, c.PackageDir, archive_dir=tmp_dir)
    app_big = utils.compose_package(apps_names[1], manifest, c.PackageDir, archive_dir=tmp_dir)
    change_archive_size(app_small, 1.99)
    change_archive_size(app_big, 2.01)
    return [app_small, app_big]
Exemplo n.º 4
0
def prepare_zips():
    def change_archive_size(archive_name, size):
        file_name = os.path.join(os.path.split(archive_name)[0], 'file')
        initial_size = os.path.getsize(archive_name)
        with open(file_name, 'wb') as f:
            f.seek(size * 1024 * 1024 - initial_size - 1)
            f.write('\0')
        with zipfile.ZipFile(archive_name, 'a') as archive:
            archive.write(file_name)
    tmp_dir = tempfile.mkdtemp()
    manifest = os.path.join(c.PackageDir, 'manifest.yaml')
    app_small = utils.compose_package(
        apps_names[0], manifest, c.PackageDir, archive_dir=tmp_dir)
    app_big = utils.compose_package(
        apps_names[1], manifest, c.PackageDir, archive_dir=tmp_dir)
    change_archive_size(app_small, 1.99)
    change_archive_size(app_big, 2.01)
    return [app_small, app_big]
Exemplo n.º 5
0
    def _compose_app(self, name, require=None):
        package_dir = os.path.join(self.serve_dir, 'apps/', name)
        shutil.copytree(c.PackageDir, package_dir)

        app_name = utils.compose_package(
            name,
            os.path.join(package_dir, 'manifest.yaml'),
            package_dir,
            require=require,
            archive_dir=os.path.join(self.serve_dir, 'apps/'),
        )
        self._apps_to_delete.add(name)
        return app_name
Exemplo n.º 6
0
    def _compose_app(self, name, require=None):
        package_dir = os.path.join(self.serve_dir, 'apps/', name)
        shutil.copytree(c.PackageDir, package_dir)

        app_name = utils.compose_package(
            name,
            os.path.join(package_dir, 'manifest.yaml'),
            package_dir,
            require=require,
            archive_dir=os.path.join(self.serve_dir, 'apps/'),
        )
        self._apps_to_delete.add(name)
        return app_name