summaryrefslogtreecommitdiffstats
path: root/tests/test_symbolic_mode.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:54:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:58:39 +0000
commit129a1fb4dbc375be0fa926964aa1be46a0cdbbef (patch)
tree04c0088df47415b24a5be1325d3656b8c3881c04 /tests/test_symbolic_mode.py
parentInitial commit. (diff)
downloaddebputy-129a1fb4dbc375be0fa926964aa1be46a0cdbbef.tar.xz
debputy-129a1fb4dbc375be0fa926964aa1be46a0cdbbef.zip
Adding upstream version 0.1.21.upstream/0.1.21
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_symbolic_mode.py')
-rw-r--r--tests/test_symbolic_mode.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_symbolic_mode.py b/tests/test_symbolic_mode.py
new file mode 100644
index 0000000..a0ad81d
--- /dev/null
+++ b/tests/test_symbolic_mode.py
@@ -0,0 +1,25 @@
+import pytest
+
+from debputy.manifest_parser.base_types import SymbolicMode
+
+
+@pytest.mark.parametrize(
+ "base_mode,is_dir,symbolic_mode,expected",
+ [
+ (0o0644, False, "u+rwX,og=rX", 0o0644),
+ (0o0000, False, "u+rwX,og=rX", 0o0644),
+ (0o0400, True, "u+rwX,og=rX", 0o0755),
+ (0o0000, True, "u+rwX,og=rX", 0o0755),
+ (0o2400, False, "u+rwxs,og=rx", 0o04755),
+ (0o7400, False, "u=rwX,og=rX", 0o0644),
+ (0o0641, False, "u=rwX,og=rX", 0o0755),
+ (0o4755, False, "a-x", 0o04644),
+ ],
+)
+def test_generate_deb_filename(
+ attribute_path, base_mode, is_dir, symbolic_mode, expected
+):
+ print(attribute_path.path)
+ parsed_mode = SymbolicMode.parse_filesystem_mode(symbolic_mode, attribute_path)
+ actual = parsed_mode.compute_mode(base_mode, is_dir)
+ assert oct(actual)[2:] == oct(expected)[2:]