aboutsummaryrefslogtreecommitdiffstats
path: root/tests/archive_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/archive_tests.py')
-rw-r--r--tests/archive_tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/archive_tests.py b/tests/archive_tests.py
index 70979093..dac02a04 100644
--- a/tests/archive_tests.py
+++ b/tests/archive_tests.py
@@ -8,6 +8,7 @@ import tempfile
import shutil
from sos.archive import TarFileArchive
+from sos.utilities import tail
# PYCOMPAT
import six
@@ -38,6 +39,19 @@ class TarFileArchiveTest(unittest.TestCase):
self.check_for_file('test/tests/ziptest')
+ # when the string comes from tail() output
+ def test_add_string_from_file(self):
+ self.copy_strings = []
+ testfile = tempfile.NamedTemporaryFile(dir=self.tmpdir, delete=False)
+ testfile.write(six.b("*" * 1000))
+ testfile.flush()
+ testfile.close()
+
+ self.copy_strings.append((tail(testfile.name, 100), 'string_test.txt'))
+ self.tf.add_string(self.copy_strings[0][0], 'tests/string_test.txt')
+ self.tf.finalize('auto')
+
+
# Since commit 179d9bb add_file does not support recursive directory
# addition. Disable this test for now.
# def test_add_dir(self):