23 lines
814 B
Python
23 lines
814 B
Python
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from core.dev3.provenance import inventory
|
|
from core.provenance import ProvenanceError
|
|
|
|
|
|
class InventoryTests(unittest.TestCase):
|
|
def test_inventory_captures_content_modes_and_rejects_symlinks(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
root = Path(directory)
|
|
script = root / "entry"
|
|
script.write_text("first")
|
|
original = inventory(root)
|
|
script.chmod(0o700)
|
|
self.assertNotEqual(inventory(root), original)
|
|
script.write_text("second")
|
|
self.assertNotEqual(inventory(root)["entry"][0], original["entry"][0])
|
|
(root / "link").symlink_to(script)
|
|
with self.assertRaises(ProvenanceError):
|
|
inventory(root)
|