summaryrefslogtreecommitdiff
path: root/tests/test_recursiveloader.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-29 18:43:33 +0100
committerMichał Górny <mgorny@gentoo.org>2017-10-29 18:43:33 +0100
commit5101b85ae250726a7d9d9068cec31dfa9559c0ad (patch)
treec315850dca3e1cb342bb352aaa14093eacae1a9e /tests/test_recursiveloader.py
parentb9f59789981c82b3220832ba228f16d31732da2c (diff)
downloadgemato-5101b85ae250726a7d9d9068cec31dfa9559c0ad.tar.gz
recursiveloader: Fix telling filesize of compressed files
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r--tests/test_recursiveloader.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py
index 6f8f4e1..8f0a830 100644
--- a/tests/test_recursiveloader.py
+++ b/tests/test_recursiveloader.py
@@ -8,6 +8,7 @@ import datetime
import gzip
import io
import os
+import unittest
import gemato.cli
import gemato.exceptions
@@ -2399,6 +2400,54 @@ class CreateNewManifestTest(TempDirTestCase):
self.assertTrue(os.path.exists(
os.path.join(self.dir, 'Manifest')))
+ def test_compress_manifests_low_watermark_bz2(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'),
+ allow_create=True,
+ hashes=['SHA256', 'SHA512'])
+ try:
+ m.save_manifests(force=True, compress_watermark=0,
+ compress_format='bz2')
+ except gemato.exceptions.UnsupportedCompression:
+ raise unittest.SkipTest('bz2 compression unsupported')
+ else:
+ self.assertFalse(os.path.exists(
+ os.path.join(self.dir, 'Manifest')))
+ self.assertTrue(os.path.exists(
+ os.path.join(self.dir, 'Manifest.bz2')))
+
+ def test_compress_manifests_low_watermark_lzma(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'),
+ allow_create=True,
+ hashes=['SHA256', 'SHA512'])
+ try:
+ m.save_manifests(force=True, compress_watermark=0,
+ compress_format='lzma')
+ except gemato.exceptions.UnsupportedCompression:
+ raise unittest.SkipTest('lzma compression unsupported')
+ else:
+ self.assertFalse(os.path.exists(
+ os.path.join(self.dir, 'Manifest')))
+ self.assertTrue(os.path.exists(
+ os.path.join(self.dir, 'Manifest.lzma')))
+
+ def test_compress_manifests_low_watermark_xz(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'),
+ allow_create=True,
+ hashes=['SHA256', 'SHA512'])
+ try:
+ m.save_manifests(force=True, compress_watermark=0,
+ compress_format='xz')
+ except gemato.exceptions.UnsupportedCompression:
+ raise unittest.SkipTest('xz compression unsupported')
+ else:
+ self.assertFalse(os.path.exists(
+ os.path.join(self.dir, 'Manifest')))
+ self.assertTrue(os.path.exists(
+ os.path.join(self.dir, 'Manifest.xz')))
+
def test_cli_compress_manifests_low_watermark(self):
self.assertEqual(
gemato.cli.main(['gemato', 'create',