def test_install(self):

        # Test _valid_composer=False throws exception
        mock = MagicMock(return_value=False)
        with patch.object(composer, '_valid_composer', mock):
            self.assertRaises(CommandNotFoundError, composer.install, 'd')

        # Test no directory specified throws exception
        mock = MagicMock(return_value=True)
        with patch.object(composer, '_valid_composer', mock):
            self.assertRaises(SaltInvocationError, composer.install, None)

        # Test `composer install` exit status != 0 throws exception
        mock = MagicMock(return_value=True)
        with patch.object(composer, '_valid_composer', mock):
            mock = MagicMock(return_value={'retcode': 1, 'stderr': 'A'})
            with patch.dict(composer.__salt__, {'cmd.run_all': mock}):
                self.assertRaises(CommandExecutionError, composer.install, 'd')

        # Test success with quiet=True returns True
        mock = MagicMock(return_value=True)
        with patch.object(composer, '_valid_composer', mock):
            mock = MagicMock(return_value={'retcode': 0, 'stderr': 'A'})
            with patch.dict(composer.__salt__, {'cmd.run_all': mock}):
                self.assertTrue(composer.install('dir', None, None, None, None,
                                                 None, None, None, None, None,
                                                 True))

        # Test success with quiet=False returns object
        mock = MagicMock(return_value=True)
        with patch.object(composer, '_valid_composer', mock):
            rval = {'retcode': 0, 'stderr': 'A', 'stdout': 'B'}
            mock = MagicMock(return_value=rval)
            with patch.dict(composer.__salt__, {'cmd.run_all': mock}):
                self.assertEqual(composer.install('dir'), rval)
Test for Install composer dependencies for a directory.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/composer_test.py/ComposerTestCase.test_install