

def test_install(self):
    '\n        Test if it install a module from cpan\n        '
    mock = MagicMock(return_value='')
    with patch.dict(cpan.__salt__, {
        'cmd.run': self,
    }):
        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,
            })

dataset/ETHPy150Open saltstack/salt/tests/unit/modules/cpan_test.py CpanTestCase.test_install/VarMisuse@34/66 `mock`->`self`