[displaymanager] Add tests that run parts of the DM code

- load and set autologin for greetd (this was used to shake out
  code bugs in load/save)
- load and set autologin for sddm
This commit is contained in:
Adriaan de Groot 2021-11-15 12:49:20 +01:00
parent 2c186132cd
commit f3e85efd41
3 changed files with 40 additions and 0 deletions

View File

@ -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()

View File

@ -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")

View File

@ -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")