Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing mock, to prevent bleed through to test system #5082

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/unittests/config/test_apt_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_apt_key_list_success_machine(self, m_gpg):

@mock.patch.object(cc_apt_configure.os, "listdir", return_value=())
@mock.patch.object(cc_apt_configure.os.path, "isfile", return_value=False)
def test_apt_key_list_fail_no_keys(self, m_listdir, m_gpg):
def test_apt_key_list_fail_no_keys(self, m_isfile, m_listdir, m_gpg):
"""Ensure falsy output for no keys"""
keys = cc_apt_configure.apt_key("list", m_gpg)
assert not keys
Expand All @@ -138,7 +138,9 @@ def test_apt_key_list_fail_no_keys_file(self, m_listdir, m_gpg, *args):
"list", m_gpg
)

def test_apt_key_list_fail_bad_key_file(self, m_gpg):
@mock.patch.object(cc_apt_configure.os, "listdir", return_value=())
@mock.patch.object(cc_apt_configure.os.path, "isfile", return_value=False)
def test_apt_key_list_fail_bad_key_file(self, m_isfile, m_listdir, m_gpg):
"""Ensure bad gpg key doesn't throw exeption."""
m_gpg.list_keys = mock.Mock(side_effect=subp.ProcessExecutionError)
assert not cc_apt_configure.apt_key("list", m_gpg)
Loading