From a1af721b79fa72c109d408f3848f72f8d86c9f00 Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Sat, 30 Jul 2022 16:03:20 +0200 Subject: [PATCH] Improves readability of newly-added test case names --- .../etc/os-release | 0 .../tmp/another-link | 0 .../absolute_symlinks/usr/lib/os-release | 1 + .../absolutesymlinks/usr/lib/os-release | 1 - .../distro/root_dir_escape/etc/os-release | 1 + .../etc/os-release | 0 .../tmp/another-link | 0 .../tmp/nested/nested/.gitkeep | 0 .../root_dir_non_escape/usr/lib/os-release | 1 + .../distro/rootdirescape/etc/os-release | 1 - .../rootdirnonescape/usr/lib/os-release | 1 - .../distro/symlinks_loop/etc/os-release | 1 + .../symlinks_loop/etc/os-release-symlink | 1 + .../distro/symlinksloop/etc/os-release | 1 - .../symlinksloop/etc/os-release-symlink | 1 - tests/test_distro.py | 20 +++++++++---------- 16 files changed, 15 insertions(+), 15 deletions(-) rename tests/resources/testdistros/distro/{absolutesymlinks => absolute_symlinks}/etc/os-release (100%) rename tests/resources/testdistros/distro/{absolutesymlinks => absolute_symlinks}/tmp/another-link (100%) create mode 100644 tests/resources/testdistros/distro/absolute_symlinks/usr/lib/os-release delete mode 100644 tests/resources/testdistros/distro/absolutesymlinks/usr/lib/os-release create mode 100644 tests/resources/testdistros/distro/root_dir_escape/etc/os-release rename tests/resources/testdistros/distro/{rootdirnonescape => root_dir_non_escape}/etc/os-release (100%) rename tests/resources/testdistros/distro/{rootdirnonescape => root_dir_non_escape}/tmp/another-link (100%) rename tests/resources/testdistros/distro/{rootdirnonescape => root_dir_non_escape}/tmp/nested/nested/.gitkeep (100%) create mode 100644 tests/resources/testdistros/distro/root_dir_non_escape/usr/lib/os-release delete mode 120000 tests/resources/testdistros/distro/rootdirescape/etc/os-release delete mode 100644 tests/resources/testdistros/distro/rootdirnonescape/usr/lib/os-release create mode 100644 tests/resources/testdistros/distro/symlinks_loop/etc/os-release create mode 100644 tests/resources/testdistros/distro/symlinks_loop/etc/os-release-symlink delete mode 120000 tests/resources/testdistros/distro/symlinksloop/etc/os-release delete mode 120000 tests/resources/testdistros/distro/symlinksloop/etc/os-release-symlink diff --git a/tests/resources/testdistros/distro/absolutesymlinks/etc/os-release b/tests/resources/testdistros/distro/absolute_symlinks/etc/os-release similarity index 100% rename from tests/resources/testdistros/distro/absolutesymlinks/etc/os-release rename to tests/resources/testdistros/distro/absolute_symlinks/etc/os-release diff --git a/tests/resources/testdistros/distro/absolutesymlinks/tmp/another-link b/tests/resources/testdistros/distro/absolute_symlinks/tmp/another-link similarity index 100% rename from tests/resources/testdistros/distro/absolutesymlinks/tmp/another-link rename to tests/resources/testdistros/distro/absolute_symlinks/tmp/another-link diff --git a/tests/resources/testdistros/distro/absolute_symlinks/usr/lib/os-release b/tests/resources/testdistros/distro/absolute_symlinks/usr/lib/os-release new file mode 100644 index 00000000..4b4715aa --- /dev/null +++ b/tests/resources/testdistros/distro/absolute_symlinks/usr/lib/os-release @@ -0,0 +1 @@ +ID=absolute_symlinks diff --git a/tests/resources/testdistros/distro/absolutesymlinks/usr/lib/os-release b/tests/resources/testdistros/distro/absolutesymlinks/usr/lib/os-release deleted file mode 100644 index 59b0f768..00000000 --- a/tests/resources/testdistros/distro/absolutesymlinks/usr/lib/os-release +++ /dev/null @@ -1 +0,0 @@ -ID=absolutesymlinks diff --git a/tests/resources/testdistros/distro/root_dir_escape/etc/os-release b/tests/resources/testdistros/distro/root_dir_escape/etc/os-release new file mode 100644 index 00000000..0ab195d7 --- /dev/null +++ b/tests/resources/testdistros/distro/root_dir_escape/etc/os-release @@ -0,0 +1 @@ +../../../../distros/debian8/etc/os-release \ No newline at end of file diff --git a/tests/resources/testdistros/distro/rootdirnonescape/etc/os-release b/tests/resources/testdistros/distro/root_dir_non_escape/etc/os-release similarity index 100% rename from tests/resources/testdistros/distro/rootdirnonescape/etc/os-release rename to tests/resources/testdistros/distro/root_dir_non_escape/etc/os-release diff --git a/tests/resources/testdistros/distro/rootdirnonescape/tmp/another-link b/tests/resources/testdistros/distro/root_dir_non_escape/tmp/another-link similarity index 100% rename from tests/resources/testdistros/distro/rootdirnonescape/tmp/another-link rename to tests/resources/testdistros/distro/root_dir_non_escape/tmp/another-link diff --git a/tests/resources/testdistros/distro/rootdirnonescape/tmp/nested/nested/.gitkeep b/tests/resources/testdistros/distro/root_dir_non_escape/tmp/nested/nested/.gitkeep similarity index 100% rename from tests/resources/testdistros/distro/rootdirnonescape/tmp/nested/nested/.gitkeep rename to tests/resources/testdistros/distro/root_dir_non_escape/tmp/nested/nested/.gitkeep diff --git a/tests/resources/testdistros/distro/root_dir_non_escape/usr/lib/os-release b/tests/resources/testdistros/distro/root_dir_non_escape/usr/lib/os-release new file mode 100644 index 00000000..dc081fb6 --- /dev/null +++ b/tests/resources/testdistros/distro/root_dir_non_escape/usr/lib/os-release @@ -0,0 +1 @@ +ID=root_dir_non_escape diff --git a/tests/resources/testdistros/distro/rootdirescape/etc/os-release b/tests/resources/testdistros/distro/rootdirescape/etc/os-release deleted file mode 120000 index 0ab195d7..00000000 --- a/tests/resources/testdistros/distro/rootdirescape/etc/os-release +++ /dev/null @@ -1 +0,0 @@ -../../../../distros/debian8/etc/os-release \ No newline at end of file diff --git a/tests/resources/testdistros/distro/rootdirnonescape/usr/lib/os-release b/tests/resources/testdistros/distro/rootdirnonescape/usr/lib/os-release deleted file mode 100644 index eb5cf1d4..00000000 --- a/tests/resources/testdistros/distro/rootdirnonescape/usr/lib/os-release +++ /dev/null @@ -1 +0,0 @@ -ID=rootdirnonescape diff --git a/tests/resources/testdistros/distro/symlinks_loop/etc/os-release b/tests/resources/testdistros/distro/symlinks_loop/etc/os-release new file mode 100644 index 00000000..b2d29bbb --- /dev/null +++ b/tests/resources/testdistros/distro/symlinks_loop/etc/os-release @@ -0,0 +1 @@ +os-release-symlink \ No newline at end of file diff --git a/tests/resources/testdistros/distro/symlinks_loop/etc/os-release-symlink b/tests/resources/testdistros/distro/symlinks_loop/etc/os-release-symlink new file mode 100644 index 00000000..37508ac2 --- /dev/null +++ b/tests/resources/testdistros/distro/symlinks_loop/etc/os-release-symlink @@ -0,0 +1 @@ +os-release \ No newline at end of file diff --git a/tests/resources/testdistros/distro/symlinksloop/etc/os-release b/tests/resources/testdistros/distro/symlinksloop/etc/os-release deleted file mode 120000 index b2d29bbb..00000000 --- a/tests/resources/testdistros/distro/symlinksloop/etc/os-release +++ /dev/null @@ -1 +0,0 @@ -os-release-symlink \ No newline at end of file diff --git a/tests/resources/testdistros/distro/symlinksloop/etc/os-release-symlink b/tests/resources/testdistros/distro/symlinksloop/etc/os-release-symlink deleted file mode 120000 index 37508ac2..00000000 --- a/tests/resources/testdistros/distro/symlinksloop/etc/os-release-symlink +++ /dev/null @@ -1 +0,0 @@ -os-release \ No newline at end of file diff --git a/tests/test_distro.py b/tests/test_distro.py index 52a1eb9d..2e6b60e4 100644 --- a/tests/test_distro.py +++ b/tests/test_distro.py @@ -731,30 +731,30 @@ def test_empty_release(self) -> None: desired_outcome = {"id": "empty"} self._test_outcome(desired_outcome) - def test_absolutesymlinks(self) -> None: + def test_absolute_symlinks(self) -> None: self.distro = distro.LinuxDistribution( - root_dir=os.path.join(TESTDISTROS, "distro", "absolutesymlinks") + root_dir=os.path.join(TESTDISTROS, "distro", "absolute_symlinks") ) - desired_outcome = {"id": "absolutesymlinks"} + desired_outcome = {"id": "absolute_symlinks"} self._test_outcome(desired_outcome) - def test_rootdirescape(self) -> None: + def test_root_dir_escape(self) -> None: self.distro = distro.LinuxDistribution( - root_dir=os.path.join(TESTDISTROS, "distro", "rootdirescape") + root_dir=os.path.join(TESTDISTROS, "distro", "root_dir_escape") ) # loading existing file outside of root_dir has been prevented (empty data) self._test_outcome({}) - def test_rootdirnonescape(self) -> None: + def test_root_dir_non_escape(self) -> None: self.distro = distro.LinuxDistribution( - root_dir=os.path.join(TESTDISTROS, "distro", "rootdirnonescape") + root_dir=os.path.join(TESTDISTROS, "distro", "root_dir_non_escape") ) - desired_outcome = {"id": "rootdirnonescape"} + desired_outcome = {"id": "root_dir_non_escape"} self._test_outcome(desired_outcome) - def test_symlinksloop(self) -> None: + def test_symlinks_loop(self) -> None: self.distro = distro.LinuxDistribution( - root_dir=os.path.join(TESTDISTROS, "distro", "symlinksloop") + root_dir=os.path.join(TESTDISTROS, "distro", "symlinks_loop") ) # due to symbolic links loop, loading of file has been prevented (empty data) self._test_outcome({})