Exemple #1
0
 def test_a2disconf_exception(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     mock = MagicMock(side_effect=Exception('error'))
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(str(deb_apache.a2disconf('security')), 'error')
 def test_a2disconf_exception(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     mock = MagicMock(side_effect=Exception('error'))
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(str(deb_apache.a2disconf('security')),
             'error')
Exemple #3
0
 def test_a2disconf_exception(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     with patch('salt.utils.path.which', MagicMock(return_value='a2disconf')):
         mock = MagicMock(side_effect=Exception('error'))
         with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
             self.assertEqual(six.text_type(deb_apache.a2disconf('security')),
                 'error')
Exemple #4
0
 def test_a2disconf_exception(self):
     """
     Test if it runs a2disconf for the given conf.
     """
     with patch("salt.utils.path.which",
                MagicMock(return_value="a2disconf")):
         mock = MagicMock(side_effect=Exception("error"))
         with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}):
             self.assertEqual(
                 six.text_type(deb_apache.a2disconf("security")), "error")
 def test_a2disconf(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     mock = MagicMock(return_value=2)
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(deb_apache.a2disconf('security'),
             {'Name': 'Apache2 Disable Conf',
             'Conf': 'security',
             'Status': 2})
Exemple #6
0
 def test_a2disconf(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     mock = MagicMock(return_value=2)
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(deb_apache.a2disconf('security'),
             {'Name': 'Apache2 Disable Conf',
             'Conf': 'security',
             'Status': 2})
Exemple #7
0
 def test_a2disconf_disabled(self):
     '''
     Test if it runs a2disconf for the given conf.
     '''
     with patch('salt.utils.path.which', MagicMock(return_value='a2disconf')):
         mock = MagicMock(return_value=0)
         with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
             self.assertEqual(deb_apache.a2disconf('security'),
                 {'Name': 'Apache2 Disable Conf',
                 'Conf': 'security',
                 'Status': 'Conf security disabled'})
Exemple #8
0
 def test_a2disconf(self):
     """
     Test if it runs a2disconf for the given conf.
     """
     with patch("salt.utils.path.which",
                MagicMock(return_value="a2disconf")):
         mock = MagicMock(return_value=2)
         with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}):
             self.assertEqual(
                 deb_apache.a2disconf("security"),
                 {
                     "Name": "Apache2 Disable Conf",
                     "Conf": "security",
                     "Status": 2
                 },
             )