Example #1
0
 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")
Example #3
0
 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')
Example #4
0
 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})
Example #5
0
 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})
Example #6
0
 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
             },
         )