Skip to content

Commit

Permalink
Add test for fix when user does not exists on pip
Browse files Browse the repository at this point in the history
  • Loading branch information
scornelissen85 committed Nov 18, 2023
1 parent e11fa06 commit 901661c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/states/test_pip_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,24 @@ def test_install_in_editable_mode(self):
self.assertSaltTrueReturn({"test": ret})
self.assertInSaltComment("successfully installed", {"test": ret})

def test_install_with_specified_user(self):
"""
Check that if `user` parameter is set and the user does not exists
it will fail with an error, see #65458
"""
user_info = MagicMock(return_value={})
pip_version = MagicMock(return_value="10.0.1")
with patch.dict(
pip_state.__salt__,
{
"user.info": user_info,
"pip.version": pip_version,
},
):
ret = pip_state.installed("mypkg", user="fred")
self.assertSaltFalseReturn({"test": ret})
self.assertInSaltComment("User fred does not exist", {"test": ret})


class PipStateUtilsTest(TestCase):
def test_has_internal_exceptions_mod_function(self):
Expand Down

0 comments on commit 901661c

Please sign in to comment.