Menu
BifrOSt
publicLatest change 995290fa505c425e8021890af463ee44e0d76fae - Restore live networking and add WiFi setup by Ólafur Búi Ólafsson
from __future__ import annotations
from pathlib import Path
import py_compile
import unittest
ROOT = Path(__file__).resolve().parents[1]
PROFILE = ROOT / "profile"
INSTALLER = PROFILE / "airootfs/usr/local/bin/bifrost-installer"
class LiveNetworkingTest(unittest.TestCase):
def test_networkmanager_starts_in_live_environment(self) -> None:
link = PROFILE / "airootfs/etc/systemd/system/multi-user.target.wants/NetworkManager.service"
self.assertTrue(link.is_symlink())
self.assertEqual(link.readlink(), Path("/usr/lib/systemd/system/NetworkManager.service"))
packages = (PROFILE / "packages.x86_64").read_text(encoding="utf-8").splitlines()
for package in ("networkmanager", "linux-firmware-atheros", "linux-firmware-broadcom", "linux-firmware-intel", "linux-firmware-realtek"):
self.assertIn(package, packages)
def test_installer_autostarts_only_in_cosmic_live_session(self) -> None:
desktop = (PROFILE / "airootfs/etc/xdg/autostart/org.bifrost.Installer.desktop").read_text(encoding="utf-8")
self.assertIn("Exec=/usr/local/bin/bifrost-installer\n", desktop)
self.assertIn("OnlyShowIn=COSMIC;\n", desktop)
self.assertIn("X-GNOME-Autostart-enabled=true\n", desktop)
def test_wifi_step_precedes_package_options(self) -> None:
source = INSTALLER.read_text(encoding="utf-8")
self.assertLess(source.index("self._wifi_page()"), source.index("self._options_page()"))
self.assertIn('["nmcli", "-t", "-f", "SSID,SIGNAL,SECURITY"', source)
self.assertIn('["nmcli", "device", "wifi", "connect", ssid]', source)
py_compile.compile(str(INSTALLER), doraise=True)
if __name__ == "__main__":
unittest.main()