Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_archive_permissions(self, sp, env):
with tempfile.TemporaryDirectory() as tmpdir:
target = Path(tmpdir, "test.zip")
create_archive(sp, target, sys.executable, "code:interact", env)
assert target.stat().st_mode & UGOX == UGOX
def test_create_archive(self, sp, env):
with tempfile.TemporaryDirectory() as tmpdir:
target = Path(tmpdir, "test.zip")
# create an archive
create_archive(sp, target, sys.executable, "code:interact", env)
# create one again (to ensure we overwrite)
create_archive(sp, target, sys.executable, "code:interact", env)
assert zipfile.is_zipfile(str(target))
with pytest.raises(ZipAppError):
create_archive(sp, target, sys.executable, "alsjdbas,,,", env)
def test_create_archive(self, sp, env):
with tempfile.TemporaryDirectory() as tmpdir:
target = Path(tmpdir, "test.zip")
# create an archive
create_archive(sp, target, sys.executable, "code:interact", env)
# create one again (to ensure we overwrite)
create_archive(sp, target, sys.executable, "code:interact", env)
assert zipfile.is_zipfile(str(target))
with pytest.raises(ZipAppError):
create_archive(sp, target, sys.executable, "alsjdbas,,,", env)