summaryrefslogtreecommitdiffstats
path: root/tests/test_debputy_plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_debputy_plugin.py')
-rw-r--r--tests/test_debputy_plugin.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/test_debputy_plugin.py b/tests/test_debputy_plugin.py
index a5d7758..dc60597 100644
--- a/tests/test_debputy_plugin.py
+++ b/tests/test_debputy_plugin.py
@@ -1,6 +1,6 @@
import os
import textwrap
-from typing import Sequence
+from typing import Sequence, Any, List, Optional
import pytest
@@ -643,6 +643,8 @@ def test_system_service_detection() -> None:
systemd_service_system_dir = f"{systemd_service_root_dir}/system"
systemd_service_user_dir = f"{systemd_service_root_dir}/user"
+ services: List[DetectedService[Optional[object]]]
+
services, _ = plugin.run_service_detection_and_integrations(
"systemd", build_virtual_file_system([])
)
@@ -704,7 +706,9 @@ def test_system_service_detection() -> None:
assert foo_service.enable_by_default
assert foo_service.start_by_default
assert foo_service.default_upgrade_rule == "restart"
- assert foo_service.service_context.had_install_section
+ foo_service_context = foo_service.service_context
+ assert isinstance(foo_service_context, SystemdServiceContext)
+ assert foo_service_context.had_install_section
bar_timer = _extract_service(services, "bar.timer")
assert set(bar_timer.names) == {"bar.timer"}
@@ -713,7 +717,9 @@ def test_system_service_detection() -> None:
assert not bar_timer.enable_by_default
assert bar_timer.start_by_default
assert bar_timer.default_upgrade_rule == "restart"
- assert not bar_timer.service_context.had_install_section
+ bar_service_context = bar_timer.service_context
+ assert isinstance(bar_service_context, SystemdServiceContext)
+ assert not bar_service_context.had_install_section
snippets = metadata.maintscripts()
assert len(snippets) == 4
@@ -742,6 +748,8 @@ def test_sysv_service_detection() -> None:
)
init_dir = "etc/init.d"
+ services: List[DetectedService[Optional[object]]]
+
services, _ = plugin.run_service_detection_and_integrations(
"sysvinit", build_virtual_file_system([])
)
@@ -1135,9 +1143,9 @@ def test_pam_auth_update() -> None:
assert postinst.registration_method == "on_configure"
assert "pam-auth-update --package" in postinst.plugin_provided_script
- prerms = prerms[0]
- assert prerms.registration_method == "on_before_removal"
- assert "pam-auth-update --package --remove foo-pam" in prerms.plugin_provided_script
+ prerm = prerms[0]
+ assert prerm.registration_method == "on_before_removal"
+ assert "pam-auth-update --package --remove foo-pam" in prerm.plugin_provided_script
def test_auto_depends_solink() -> None: