From a8f4da609948be5424121d1cc060594330d8f67d Mon Sep 17 00:00:00 2001 From: Andreas Hasenack Date: Mon, 1 Jan 2024 11:10:19 -0300 Subject: [PATCH] test_cli_collect_logs: account for apparmor profiles not being redacted --- uaclient/cli/tests/test_cli_collect_logs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uaclient/cli/tests/test_cli_collect_logs.py b/uaclient/cli/tests/test_cli_collect_logs.py index 5a9a4e7375..5b4fb79cc7 100644 --- a/uaclient/cli/tests/test_cli_collect_logs.py +++ b/uaclient/cli/tests/test_cli_collect_logs.py @@ -4,6 +4,8 @@ import mock import pytest +from uaclient.actions import APPARMOR_PROFILES + from uaclient.cli import ( action_collect_logs, collect_logs_parser, @@ -92,7 +94,7 @@ def test_collect_logs( tmpdir.join("user1-log").strpath, tmpdir.join("user2-log").strpath, ] - is_file_calls = 17 + is_file_calls = 17 + len(APPARMOR_PROFILES) user_log_files = [mock.call(m_get_user())] if util_we_are_currently_root(): user_log_files = [ @@ -185,8 +187,10 @@ def test_collect_logs( mock.call("/etc/apt/sources.list.d/ubuntu-ros-updates.list"), mock.call("/var/log/ubuntu-advantage.log"), mock.call("/var/log/ubuntu-advantage.log.1"), + mock.call("/etc/apparmor.d/ubuntu_pro_apt_news"), ] - assert redact.call_count == is_file_calls + len(user_log_files) + # APPARMOR_PROFILES are not redacted + assert redact.call_count == is_file_calls + len(user_log_files) - len(APPARMOR_PROFILES) class TestParser: