summaryrefslogtreecommitdiffstatshomepage
path: root/tests/test_canonical.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_canonical.py')
-rw-r--r--tests/test_canonical.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_canonical.py b/tests/test_canonical.py
index 27fd199..14b7a3c 100644
--- a/tests/test_canonical.py
+++ b/tests/test_canonical.py
@@ -17,6 +17,23 @@ SPEC.loader.exec_module(canonical)
class PackageTests(unittest.TestCase):
+ def test_subid_failure_remains_fatal_with_setup_guidance(self):
+ def result(command, **kwargs):
+ return subprocess.CompletedProcess(
+ command, int(command[0] == "/usr/bin/getsubids")
+ )
+
+ with (
+ patch.object(canonical.subprocess, "run", side_effect=result),
+ patch("builtins.print") as printed,
+ self.assertRaises(SystemExit) as failure,
+ ):
+ canonical.check()
+ self.assertEqual(failure.exception.code, 1)
+ self.assertTrue(
+ any("just canonical-system" in str(call) for call in printed.call_args_list)
+ )
+
def test_install_does_not_enable_experimental_snap_features(self):
with patch.object(canonical.subprocess, "run") as command:
canonical.install()