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