Example #1
0
    def test_uninstall(self):
        '''
        Test if it uninstall an NPM package.
        '''
        mock = MagicMock(return_value={'retcode': 1, 'stderr': 'error'})
        with patch.dict(npm.__salt__, {'cmd.run_all': mock}):
            self.assertFalse(npm.uninstall('coffee-script'))

        mock = MagicMock(return_value={'retcode': 0, 'stderr': 'error'})
        with patch.dict(npm.__salt__, {'cmd.run_all': mock}):
            self.assertTrue(npm.uninstall('coffee-script'))
Example #2
0
    def test_uninstall(self):
        """
        Test if it uninstalls an NPM package.
        """
        mock = MagicMock(return_value={"retcode": 1, "stderr": "error"})
        with patch.dict(npm.__salt__, {"cmd.run_all": mock}):
            self.assertFalse(npm.uninstall("coffee-script"))

        mock = MagicMock(return_value={"retcode": 0, "stderr": ""})
        with patch.dict(npm.__salt__, {"cmd.run_all": mock}):
            self.assertTrue(npm.uninstall("coffee-script"))