def test_a2dismod_exception(self): ''' Test if it runs a2dismod for the given site. ''' mock = MagicMock(side_effect=Exception('error')) with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}): self.assertEqual(str(deb_apache.a2dismod('vhost_alias')), 'error')
def test_a2dismod_exception(self): """ Test if it runs a2dismod for the given module. """ mock = MagicMock(side_effect=Exception("error")) with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}): self.assertEqual(str(deb_apache.a2dismod("vhost_alias")), "error")
def test_a2dismod(self): ''' Test if it runs a2dismod for the given site. ''' mock = MagicMock(return_value=2) with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}): self.assertEqual(deb_apache.a2dismod('vhost_alias'), {'Name': 'Apache2 Disable Mod', 'Mod': 'vhost_alias', 'Status': 2})
def test_a2dismod(self): ''' Test if it runs a2dismod for the given module. ''' mock = MagicMock(return_value=2) with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}): self.assertEqual(deb_apache.a2dismod('vhost_alias'), {'Name': 'Apache2 Disable Mod', 'Mod': 'vhost_alias', 'Status': 2})
def test_a2dismod(self): """ Test if it runs a2dismod for the given module. """ mock = MagicMock(return_value=2) with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}): self.assertEqual( deb_apache.a2dismod("vhost_alias"), { "Name": "Apache2 Disable Mod", "Mod": "vhost_alias", "Status": 2 }, )