def test_removed(self):
        name = 'coffee-script'

        ret = {'name': name,
               'result': False,
               'comment': '',
               'changes': {}}

        mock_err = MagicMock(side_effect=[CommandExecutionError, {},
                                          {name: ''}, {name: ''}])
        mock_t = MagicMock(return_value=True)
        with patch.dict(npm.__salt__, {'npm.list': mock_err,
                                       'npm.uninstall': mock_t}):
            comt = ("Error uninstalling 'coffee-script': ")
            ret.update({'comment': comt})
            self.assertDictEqual(npm.removed(name), ret)

            comt = ("Package 'coffee-script' is not installed")
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(npm.removed(name), ret)

            with patch.dict(npm.__opts__, {'test': True}):
                comt = ("Package 'coffee-script' is set to be removed")
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(npm.removed(name), ret)

            with patch.dict(npm.__opts__, {'test': False}):
                comt = ("Package 'coffee-script' was successfully removed")
                ret.update({'comment': comt, 'result': True,
                            'changes': {name: 'Removed'}})
                self.assertDictEqual(npm.removed(name), ret)

    # 'bootstrap' function tests: 1
Test to verify that the given package is not installed.
dataset/ETHPy150Open saltstack/salt/tests/unit/states/npm_test.py/NpmTestCase.test_removed