[displaymanager] Repair test for gdm3

This was intended to check code for obvious logical
failures, but also stops tests because the gdm
paths don't exist. For testing purposes, create
bogus gdm3 executable in the "target" tempdir.
This commit is contained in:
Adriaan de Groot 2024-06-20 19:21:07 +02:00
parent 84d1599845
commit 52cff12c38

View File

@ -10,10 +10,17 @@ libcalamares.globalstorage.insert("testing", True)
from src.modules.displaymanager import main
default_desktop_environment = main.DesktopEnvironment("startplasma-x11", "kde-plasma.desktop")
# Specific DM test
d = main.DMgdm("/tmp")
d.have_dm()
d.set_autologin("d", True, default_desktop_environment)
# .. and again (this time checks load/save)
d.set_autologin("d", True, default_desktop_environment)
d.set_autologin("d", True, default_desktop_environment)
import os
import tempfile
with tempfile.TemporaryDirectory(prefix="calamares-gdm") as tempdir:
os.makedirs(tempdir + "/usr/bin")
os.makedirs(tempdir + "/etc/gdm3")
with open(tempdir + "/usr/bin/gdm3", "w") as f:
f.write("#! /bin/sh\n:\n")
# Specific DM test
d = main.DMgdm(tempdir)
assert(d.have_dm())
d.set_autologin("d", True, default_desktop_environment)
# .. and again (this time checks load/save)
d.set_autologin("d", True, default_desktop_environment)
d.set_autologin("d", True, default_desktop_environment)