def test_install(self):
        mock = MagicMock(return_value='')
        with patch.dict(cpan.__salt__, {'cmd.run': mock}):
            mock = MagicMock(side_effect=[{'installed version': None},
                                          {'installed version': '3.1'}])
            with patch.object(cpan, 'show', mock):
                self.assertDictEqual(cpan.install('Alloy'),
                                     {'new': '3.1', 'old': None})
Test if it install a module from cpan
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/cpan_test.py/CpanTestCase.test_install