Moonlock lockscreen scaffolding: PAM auth (ctypes), fprintd D-Bus listener, i18n (DE/EN), user detection, power actions. 33 tests passing.
25 lines
713 B
Python
25 lines
713 B
Python
# ABOUTME: Tests for power actions (reboot, shutdown).
|
|
# ABOUTME: Verifies loginctl commands are called correctly.
|
|
|
|
from unittest.mock import patch, call
|
|
|
|
from moonlock.power import reboot, shutdown
|
|
|
|
|
|
class TestReboot:
|
|
"""Tests for the reboot function."""
|
|
|
|
@patch("moonlock.power.subprocess.run")
|
|
def test_reboot_calls_loginctl(self, mock_run):
|
|
reboot()
|
|
mock_run.assert_called_once_with(["loginctl", "reboot"], check=True)
|
|
|
|
|
|
class TestShutdown:
|
|
"""Tests for the shutdown function."""
|
|
|
|
@patch("moonlock.power.subprocess.run")
|
|
def test_shutdown_calls_loginctl(self, mock_run):
|
|
shutdown()
|
|
mock_run.assert_called_once_with(["loginctl", "poweroff"], check=True)
|