Esempio n. 1
0
    def test_chgroups(self):
        """
        Test if no group needs to be added
        """
        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {"cmd.retcode": mock}):
            mock = MagicMock(return_value=["a", "b", "c", "d"])
            with patch.object(pw_user, "list_groups", mock):
                self.assertTrue(pw_user.chgroups("name", "a, b, c, d"))

        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {"cmd.retcode": mock}):
            mock = MagicMock(return_value=["a", "b"])
            with patch.object(pw_user, "list_groups", mock):
                self.assertTrue(pw_user.chgroups("name", "a, b, c"))
Esempio n. 2
0
    def test_chgroups(self):
        '''
        Test if no group needs to be added
        '''
        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {'cmd.retcode': mock}):
            mock = MagicMock(return_value=['a', 'b', 'c', 'd'])
            with patch.object(pw_user, 'list_groups', mock):
                self.assertTrue(pw_user.chgroups('name', 'a, b, c, d'))

        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {'cmd.retcode': mock}):
            mock = MagicMock(return_value=['a', 'b'])
            with patch.object(pw_user, 'list_groups', mock):
                self.assertTrue(pw_user.chgroups('name', 'a, b, c'))
Esempio n. 3
0
    def test_chgroups(self):
        '''
        Test if no group needs to be added
        '''
        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {'cmd.retcode': mock}):
            mock = MagicMock(return_value=['a', 'b', 'c', 'd'])
            with patch.object(pw_user, 'list_groups', mock):
                self.assertTrue(pw_user.chgroups('name', 'a, b, c, d'))

        mock = MagicMock(return_value=False)
        with patch.dict(pw_user.__salt__, {'cmd.retcode': mock}):
            mock = MagicMock(return_value=['a', 'b'])
            with patch.object(pw_user, 'list_groups', mock):
                self.assertTrue(pw_user.chgroups('name', 'a, b, c'))