Skip to content

Commit

Permalink
test_cli_collect_logs: account for apparmor profiles not being redacted
Browse files Browse the repository at this point in the history
  • Loading branch information
panlinux committed Jan 1, 2024
1 parent 554667c commit a8f4da6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions uaclient/cli/tests/test_cli_collect_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import mock
import pytest

from uaclient.actions import APPARMOR_PROFILES

from uaclient.cli import (
action_collect_logs,
collect_logs_parser,
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a8f4da6

Please sign in to comment.