diff --git a/src/modules/displaymanager/tests/CMakeTests.txt b/src/modules/displaymanager/tests/CMakeTests.txt new file mode 100644 index 000000000..39c1291ca --- /dev/null +++ b/src/modules/displaymanager/tests/CMakeTests.txt @@ -0,0 +1,10 @@ +# We have tests to load (some) of the DMs specifically, to test their +# configuration code. Those tests conventionally live in Python +# files here in the tests/ directory. Add them. +foreach(_dmname greetd sddm) + add_test( + NAME configure-displaymanager-${_dmname} + COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-dm-${_dmname}.py + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +endforeach() diff --git a/src/modules/displaymanager/tests/test-dm-greetd.py b/src/modules/displaymanager/tests/test-dm-greetd.py new file mode 100644 index 000000000..8988aaa52 --- /dev/null +++ b/src/modules/displaymanager/tests/test-dm-greetd.py @@ -0,0 +1,18 @@ +# Calamares Boilerplate +import libcalamares +libcalamares.globalstorage = libcalamares.GlobalStorage(None) +libcalamares.globalstorage.insert("testing", True) +# Module prep-work +import os +os.makedirs("/tmp/etc/greetd/", exist_ok=True) +try: + os.remove("/tmp/etc/greetd/config.toml") +except FileNotFoundError as e: + pass +# Module test +from src.modules.displaymanager import main +d = main.DMgreetd("/tmp") +d.set_autologin("d", True, "kde") +# .. and again (this time checks load/save) +d.set_autologin("d", True, "kde") +d.set_autologin("d", True, "kde") diff --git a/src/modules/displaymanager/tests/test-dm-sddm.py b/src/modules/displaymanager/tests/test-dm-sddm.py new file mode 100644 index 000000000..eb65d95f4 --- /dev/null +++ b/src/modules/displaymanager/tests/test-dm-sddm.py @@ -0,0 +1,12 @@ +# Calamares Boilerplate +import libcalamares +libcalamares.globalstorage = libcalamares.GlobalStorage(None) +libcalamares.globalstorage.insert("testing", True) +# Module prep-work +# Module test +from src.modules.displaymanager import main +d = main.DMsddm("/tmp") +d.set_autologin("d", True, "kde") +# .. and again (this time checks load/save) +d.set_autologin("d", True, "kde") +d.set_autologin("d", True, "kde")