test(wallpaper_changer): move testfiles

This commit is contained in:
Lucas Vivo committed 2026-11-21 15:13:27 +01:00
1 parent 70904598fb
commit 9e8ac1d37d
5 files changed
+56 -56

No files matched your search

@@ -123,7 +123,7 @@ class ConfigTests(unittest.TestCase):
def test_load_uses_argument_passphrase_when_set(self) -> None: def test_load_uses_argument_passphrase_when_set(self) -> None:
home = Path("/home/test-user") home = Path("/home/test-user")
args = self.parse_args() args = self.parse_args()
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args.passphrase_file = assets / "test_passphrase" args.passphrase_file = assets / "test_passphrase"
with patch("pathlib.Path.home", return_value=home): with patch("pathlib.Path.home", return_value=home):
@@ -18,7 +18,7 @@ class EncryptionManagerTests(unittest.TestCase):
"""Verify encrypted bytes decrypt to the original content and hash.""" """Verify encrypted bytes decrypt to the original content and hash."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -40,7 +40,7 @@ class EncryptionManagerTests(unittest.TestCase):
def test_decrypt_rejects_wrong_passphrase(self) -> None: def test_decrypt_rejects_wrong_passphrase(self) -> None:
"""Verify decryption fails when given a different passphrase.""" """Verify decryption fails when given a different passphrase."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
shutil.copytree(assets / "corrupt", Path(temporary_directory) / "corrupt") shutil.copytree(assets / "corrupt", Path(temporary_directory) / "corrupt")
image_root = Path(temporary_directory) / "corrupt" image_root = Path(temporary_directory) / "corrupt"
passphrase_file = Path(temporary_directory) / "wrong.passphrase" passphrase_file = Path(temporary_directory) / "wrong.passphrase"
@@ -125,7 +125,7 @@ class EncryptionManagerTests(unittest.TestCase):
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(FileNotFoundError, "No naming table found"): self.assertRaisesRegex(FileNotFoundError, "No naming table found"):
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -22,7 +22,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_scan_plaintext_folder_desktop(self) -> None: def test_scan_plaintext_folder_desktop(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -46,7 +46,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_scan_plaintext_folder_corrupt(self) -> None: def test_scan_plaintext_folder_corrupt(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -65,7 +65,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_scan_enc_folder_corrupt(self) -> None: def test_scan_enc_folder_corrupt(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -88,7 +88,7 @@ class ImageRepositoryTests(unittest.TestCase):
"""Verify conversion avoids overwrites and composites transparent pixels.""" """Verify conversion avoids overwrites and composites transparent pixels."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -114,7 +114,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_encryption_ignore_same_hash_shorter_name(self) -> None: def test_check_encryption_ignore_same_hash_shorter_name(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -133,7 +133,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_encryption_ignore_same_hash_equal_length_name(self) -> None: def test_check_encryption_ignore_same_hash_equal_length_name(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -152,7 +152,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_encryption_replace_same_name(self) -> None: def test_check_encryption_replace_same_name(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -185,7 +185,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_encryption_replace_same_hash_shorter_name(self) -> None: def test_check_encryption_replace_same_hash_shorter_name(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -211,7 +211,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_encryption_set_unique_name(self) -> None: def test_check_encryption_set_unique_name(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -233,7 +233,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_decode_all(self) -> None: def test_decode_all(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -249,7 +249,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_decode_argument(self) -> None: def test_decode_argument(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -267,7 +267,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_decode_argument_remove(self) -> None: def test_decode_argument_remove(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -286,7 +286,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_check_consecutive_filenames(self) -> None: def test_check_consecutive_filenames(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -316,7 +316,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify scanning ignores unsupported files and handles corrupt image files.""" """Verify scanning ignores unsupported files and handles corrupt image files."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -341,7 +341,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify nested encrypted files are matched to their naming-table entries.""" """Verify nested encrypted files are matched to their naming-table entries."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -359,7 +359,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify plaintext JPEG payloads with an encrypted suffix are scanned safely.""" """Verify plaintext JPEG payloads with an encrypted suffix are scanned safely."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -405,7 +405,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify encryption checking is a no-op for missing or empty input folders.""" """Verify encryption checking is a no-op for missing or empty input folders."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -425,7 +425,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify failed encryption does not delete the original image.""" """Verify failed encryption does not delete the original image."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -501,7 +501,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(ValueError, "Hash mismatch for"): self.assertRaisesRegex(ValueError, "Hash mismatch for"):
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -524,7 +524,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify decode-all behavior when an encrypted image has no table entry.""" """Verify decode-all behavior when an encrypted image has no table entry."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -539,7 +539,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
"""Verify decoded images do not overwrite existing files with the same name.""" """Verify decoded images do not overwrite existing files with the same name."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -564,7 +564,7 @@ class ImageRepositoryEdgeCaseTests(unittest.TestCase):
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(ValueError, "Hash mismatch for"): self.assertRaisesRegex(ValueError, "Hash mismatch for"):
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -47,7 +47,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_headless_mode_reads_correct_config(self) -> None: def test_headless_mode_reads_correct_config(self) -> None:
"""Verify server dimensions load from the default monitor config.""" """Verify server dimensions load from the default monitor config."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--headless") args = self.parse_args("--headless")
config = Config.load(args) config = Config.load(args)
for file in (assets/"monitors").glob("monitors_[1-3]mon.xml"): for file in (assets/"monitors").glob("monitors_[1-3]mon.xml"):
@@ -65,7 +65,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_monitor_manager_uses_correct_config(self) -> None: def test_monitor_manager_uses_correct_config(self) -> None:
"""Verify incomplete, non-positive, or inconsistent dimensions are rejected.""" """Verify incomplete, non-positive, or inconsistent dimensions are rejected."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args() args = self.parse_args()
config = Config.load(args) config = Config.load(args)
file = assets / "monitors" / "monitors_2mon.xml" file = assets / "monitors" / "monitors_2mon.xml"
@@ -86,7 +86,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_monitor_manager_rejects_config_with_too_many_monitors(self) -> None: def test_monitor_manager_rejects_config_with_too_many_monitors(self) -> None:
"""Verify incomplete, non-positive, or inconsistent dimensions are rejected.""" """Verify incomplete, non-positive, or inconsistent dimensions are rejected."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
monitor_file = assets / "monitors" / "monitors_3mon.xml" monitor_file = assets / "monitors" / "monitors_3mon.xml"
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(RuntimeError, "No matching monitor configuration found"): self.assertRaisesRegex(RuntimeError, "No matching monitor configuration found"):
@@ -101,7 +101,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_monitor_manager_uses_correct_config_with_multi_monitor_config_xml(self) -> None: def test_monitor_manager_uses_correct_config_with_multi_monitor_config_xml(self) -> None:
"""Verify incomplete, non-positive, or inconsistent dimensions are rejected.""" """Verify incomplete, non-positive, or inconsistent dimensions are rejected."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args() args = self.parse_args()
config = Config.load(args) config = Config.load(args)
file = assets / "monitors" / "monitors_all.xml" file = assets / "monitors" / "monitors_all.xml"
@@ -123,7 +123,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_server_layout_rejects_missing_or_invalid_dimensions(self) -> None: def test_server_layout_rejects_missing_or_invalid_dimensions(self) -> None:
"""Verify incomplete, non-positive, or inconsistent dimensions are rejected.""" """Verify incomplete, non-positive, or inconsistent dimensions are rejected."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
monitor_file = Path(__file__).resolve().parents[3] / "test" / "assets" / "monitors" / "monitors_2mon.xml" monitor_file = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer" / "monitors" / "monitors_2mon.xml"
args = self.parse_args() args = self.parse_args()
config = Config.load(args) config = Config.load(args)
@@ -179,7 +179,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_detect_single_connected_monitor_patched_monitor(self) -> None: def test_detect_single_connected_monitor_patched_monitor(self) -> None:
"""Verify one enabled connector reports its virtual 1920x1080 size.""" """Verify one enabled connector reports its virtual 1920x1080 size."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
monitor_file = assets / "monitors" / "monitors_1mon.xml" monitor_file = assets / "monitors" / "monitors_1mon.xml"
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
@@ -220,7 +220,7 @@ class MonitorManagerTests(unittest.TestCase):
) )
def test_read_virtual_size_from_gdbus_captures(self) -> None: def test_read_virtual_size_from_gdbus_captures(self) -> None:
assets = Path(__file__).resolve().parents[3] / "test" / "assets" / "monitors" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer" / "monitors"
for filename, connector, expected in ( for filename, connector, expected in (
("gbus_call1.txt", "card1-eDP-1", (1920, 1080)), ("gbus_call1.txt", "card1-eDP-1", (1920, 1080)),
("gbus_call2.txt", "card1-HDMI-A-1", (1920, 1080)), ("gbus_call2.txt", "card1-HDMI-A-1", (1920, 1080)),
@@ -230,7 +230,7 @@ class MonitorManagerTests(unittest.TestCase):
self.assertEqual(MonitorManager._read_virtual_size_gnome(Path(connector)), expected) self.assertEqual(MonitorManager._read_virtual_size_gnome(Path(connector)), expected)
def test_read_virtual_size_from_xrandr_captures(self) -> None: def test_read_virtual_size_from_xrandr_captures(self) -> None:
assets = Path(__file__).resolve().parents[3] / "test" / "assets" / "monitors" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer" / "monitors"
for filename, connector in ( for filename, connector in (
("xrandr1.txt", "card0-HDMI-A-0"), ("xrandr1.txt", "card0-HDMI-A-0"),
("xrandr2.txt", "card1-HDMI-A-1"), ("xrandr2.txt", "card1-HDMI-A-1"),
@@ -254,7 +254,7 @@ class MonitorManagerTests(unittest.TestCase):
MonitorManager._read_virtual_size_x11(Path("card1-HDMI-A-3")) MonitorManager._read_virtual_size_x11(Path("card1-HDMI-A-3"))
def test_x11_session_uses_xrandr_for_layout(self) -> None: def test_x11_session_uses_xrandr_for_layout(self) -> None:
assets = Path(__file__).resolve().parents[3] / "test" / "assets" / "monitors" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer" / "monitors"
self.check_output.return_value = (assets / "xrandr3.txt").read_text() self.check_output.return_value = (assets / "xrandr3.txt").read_text()
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
patch.dict("os.environ", {"XDG_SESSION_TYPE": "x11"}): patch.dict("os.environ", {"XDG_SESSION_TYPE": "x11"}):
@@ -267,7 +267,7 @@ class MonitorManagerTests(unittest.TestCase):
self.check_output.assert_called_once_with(["xrandr", "--query"], text=True) self.check_output.assert_called_once_with(["xrandr", "--query"], text=True)
def test_selects_display_backend_by_session_type(self) -> None: def test_selects_display_backend_by_session_type(self) -> None:
monitor_file = Path(__file__).resolve().parents[3] / "test" / "assets" / "monitors" / "monitors_1mon.xml" monitor_file = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer" / "monitors" / "monitors_1mon.xml"
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
drm_root = Path(temporary_directory) drm_root = Path(temporary_directory)
create_drm_root(drm_root, ["card1-eDP-1"]) create_drm_root(drm_root, ["card1-eDP-1"])
@@ -294,7 +294,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_detect_multiple_monitors_from_xml_layout(self) -> None: def test_detect_multiple_monitors_from_xml_layout(self) -> None:
"""Verify two or more connected monitors map to their XML positions and sizes.""" """Verify two or more connected monitors map to their XML positions and sizes."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
monitor_file = assets / "monitors" / "monitors_3mon.xml" monitor_file = assets / "monitors" / "monitors_3mon.xml"
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
@@ -358,7 +358,7 @@ class MonitorManagerTests(unittest.TestCase):
"""Verify no active displays raises an error.""" """Verify no active displays raises an error."""
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(RuntimeError, "No enabled monitors found"): self.assertRaisesRegex(RuntimeError, "No enabled monitors found"):
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
monitor_file = assets / "monitors" / "monitors_all.xml" monitor_file = assets / "monitors" / "monitors_all.xml"
drm_root = Path(temporary_directory) drm_root = Path(temporary_directory)
@@ -376,7 +376,7 @@ class MonitorManagerTests(unittest.TestCase):
def test_reject_unmatched_monitor_configuration(self) -> None: def test_reject_unmatched_monitor_configuration(self) -> None:
"""Verify active displays without a matching XML layout raise an error.""" """Verify active displays without a matching XML layout raise an error."""
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
monitor_file = assets / "monitors" / "monitors_3mon.xml" monitor_file = assets / "monitors" / "monitors_3mon.xml"
with TemporaryDirectory() as temporary_directory, \ with TemporaryDirectory() as temporary_directory, \
self.assertRaisesRegex(RuntimeError, "No matching monitor configuration found"): self.assertRaisesRegex(RuntimeError, "No matching monitor configuration found"):
@@ -21,7 +21,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper(self) -> None: def test_build_wallpaper(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -36,7 +36,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper_encoded(self) -> None: def test_build_wallpaper_encoded(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -52,7 +52,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper_search(self) -> None: def test_build_wallpaper_search(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"-s", "Hochschwab", "-s", "Hochschwab",
@@ -73,7 +73,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper_decode_and_leave(self) -> None: def test_build_wallpaper_decode_and_leave(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "corrupt"), "--folder", str(image_root / "corrupt"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -93,7 +93,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper_left(self) -> None: def test_build_wallpaper_left(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
img_folder = image_root / "Desktop1920x1080" img_folder = image_root / "Desktop1920x1080"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
@@ -119,7 +119,7 @@ class ImageRepositoryTests(unittest.TestCase):
def test_build_wallpaper_right(self) -> None: def test_build_wallpaper_right(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
img_folder = image_root / "Desktop1920x1080" img_folder = image_root / "Desktop1920x1080"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
@@ -150,7 +150,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
def test_build_rejects_empty_monitor_layouts(self) -> None: def test_build_rejects_empty_monitor_layouts(self) -> None:
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -167,7 +167,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify building reports when exclusions leave no eligible image.""" """Verify building reports when exclusions leave no eligible image."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"-s", "Tal", "-s", "Tal",
@@ -186,7 +186,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify building reports when exclusions leave no eligible image.""" """Verify building reports when exclusions leave no eligible image."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"-s", "Tal", "See", "-s", "Tal", "See",
@@ -206,7 +206,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify separate search terms are assigned to their corresponding monitors.""" """Verify separate search terms are assigned to their corresponding monitors."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--search-mon", "See", "Meer", "--search-mon", "See", "Meer",
@@ -227,7 +227,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify building reports when exclusions leave no eligible image.""" """Verify building reports when exclusions leave no eligible image."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--exclude", "Berg", "--exclude", "Berg",
@@ -249,7 +249,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify building reports when exclusions leave no eligible image.""" """Verify building reports when exclusions leave no eligible image."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--search", "gÖller", "--search", "gÖller",
@@ -267,7 +267,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify a custom output path is created along with missing parent folders.""" """Verify a custom output path is created along with missing parent folders."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root / "wallpaper" / "custom"), args = self.parse_args("--conf-dir", str(image_root / "wallpaper" / "custom"),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -283,7 +283,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify multiple monitor images are placed in one canvas with expected dimensions.""" """Verify multiple monitor images are placed in one canvas with expected dimensions."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -302,7 +302,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify unreadable or undecryptable selected images produce an explicit error.""" """Verify unreadable or undecryptable selected images produce an explicit error."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -325,7 +325,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify unreadable or undecryptable selected images produce an explicit error.""" """Verify unreadable or undecryptable selected images produce an explicit error."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))
@@ -350,7 +350,7 @@ class WallpaperBuilderEdgeCaseTests(unittest.TestCase):
"""Verify unreadable or undecryptable selected images produce an explicit error.""" """Verify unreadable or undecryptable selected images produce an explicit error."""
with TemporaryDirectory() as temporary_directory: with TemporaryDirectory() as temporary_directory:
image_root = Path(temporary_directory) image_root = Path(temporary_directory)
assets = Path(__file__).resolve().parents[3] / "test" / "assets" assets = Path(__file__).resolve().parents[4] / "testassets" / "wallpaper_changer"
args = self.parse_args("--conf-dir", str(image_root), args = self.parse_args("--conf-dir", str(image_root),
"--folder", str(image_root / "Desktop1920x1080"), "--folder", str(image_root / "Desktop1920x1080"),
"--passphrase-file", str(assets / "test_passphrase.txt")) "--passphrase-file", str(assets / "test_passphrase.txt"))