Skip to content

Commit

Permalink
test: Add missing mocks to prevent bleed through (#5082)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjschwei authored and holmanb committed Apr 3, 2024
1 parent eb875e8 commit 9e341e9
Showing 1 changed file with 4 additions and 2 deletions.
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)

0 comments on commit 9e341e9

Please sign in to comment.