def test_chhome(self): """ Test if home directory given is same as previous home directory """ mock = MagicMock(return_value={"home": "A"}) with patch.object(pw_user, "info", mock): self.assertTrue(pw_user.chhome("name", "A")) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {"cmd.run": mock}): mock = MagicMock(side_effect=[{"home": "B"}, {"home": "B"}]) with patch.object(pw_user, "info", mock): self.assertFalse(pw_user.chhome("name", "A")) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {"cmd.run": mock}): mock = MagicMock(side_effect=[{"home": "A"}, {"home": "B"}]) with patch.object(pw_user, "info", mock): self.assertTrue(pw_user.chhome("name", "A"))
def test_chhome(self): ''' Test if home directory given is same as previous home directory ''' mock = MagicMock(return_value={'home': 'A'}) with patch.object(pw_user, 'info', mock): self.assertTrue(pw_user.chhome('name', 'A')) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {'cmd.run': mock}): mock = MagicMock(side_effect=[{'home': 'B'}, {'home': 'B'}]) with patch.object(pw_user, 'info', mock): self.assertFalse(pw_user.chhome('name', 'A')) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {'cmd.run': mock}): mock = MagicMock(side_effect=[{'home': 'A'}, {'home': 'B'}]) with patch.object(pw_user, 'info', mock): self.assertTrue(pw_user.chhome('name', 'A'))
def test_chhome(self): ''' Test if home directory given is same as previous home directory ''' mock = MagicMock(return_value={'home': 'A'}) with patch.object(pw_user, 'info', mock): self.assertTrue(pw_user.chhome('name', 'A')) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {'cmd.run': mock}): mock = MagicMock(side_effect=[{'home': 'B'}, {'home': 'B'}]) with patch.object(pw_user, 'info', mock): self.assertFalse(pw_user.chhome('name', 'A')) mock = MagicMock(return_value=None) with patch.dict(pw_user.__salt__, {'cmd.run': mock}): mock = MagicMock(side_effect=[{'home': 'A'}, {'home': 'B'}]) with patch.object(pw_user, 'info', mock): self.assertTrue(pw_user.chhome('name', 'A'))