summaryrefslogtreecommitdiff
path: root/tests/test_recursiveloader.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-25 00:15:50 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-25 00:17:58 +0200
commitb5b8d5091a7ea034863dcaafc36322ee8533cb89 (patch)
tree926368db198ed745b7eea77e64335fe04cd578d7 /tests/test_recursiveloader.py
parent9163511743a6d8c9b62fb6cd4b2a47f2ceae0b61 (diff)
downloadgemato-b5b8d5091a7ea034863dcaafc36322ee8533cb89.tar.gz
recursiveloader: Detect cross-device Manifest entries
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r--tests/test_recursiveloader.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py
index c16e7ff..38a4a07 100644
--- a/tests/test_recursiveloader.py
+++ b/tests/test_recursiveloader.py
@@ -706,3 +706,35 @@ OPTIONAL foo
m = gemato.recursiveloader.ManifestRecursiveLoader(
os.path.join(self.dir, 'Manifest'))
m.assert_directory_verifies('', strict=False)
+
+
+class CrossDeviceManifestTest(TempDirTestCase):
+ """
+ Test for a Manifest that crosses filesystem boundaries.
+ """
+
+ FILES = {
+ 'Manifest': u'''
+DATA sub/version 0 MD5 d41d8cd98f00b204e9800998ecf8427e
+''',
+ }
+
+ def setUp(self):
+ super(CrossDeviceManifestTest, self).setUp()
+ os.symlink('/proc', os.path.join(self.dir, 'sub'))
+
+ def tearDown(self):
+ os.unlink(os.path.join(self.dir, 'sub'))
+ super(CrossDeviceManifestTest, self).tearDown()
+
+ def test_assert_directory_verifies(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'))
+ self.assertRaises(gemato.exceptions.ManifestCrossDevice,
+ m.assert_directory_verifies, '')
+
+ def test_assert_directory_verifies_nonstrict(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'))
+ self.assertRaises(gemato.exceptions.ManifestCrossDevice,
+ m.assert_directory_verifies, '', strict=False)