Exemple #1
0
 def test_a2dissite_exception(self):
     """
     Test if it runs a2dissite for the given site.
     """
     mock = MagicMock(side_effect=Exception("error"))
     with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}):
         self.assertEqual(
             six.text_type(deb_apache.a2dissite("saltstack.com")), "error")
Exemple #2
0
 def test_a2dissite_exception(self):
     '''
     Test if it runs a2dissite for the given site.
     '''
     mock = MagicMock(side_effect=Exception('error'))
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(str(deb_apache.a2dissite('saltstack.com')),
                          'error')
Exemple #3
0
 def test_a2dissite_exception(self):
     '''
     Test if it runs a2dissite for the given site.
     '''
     mock = MagicMock(side_effect=Exception('error'))
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(str(deb_apache.a2dissite('saltstack.com')),
                          'error')
Exemple #4
0
 def test_a2dissite_notfound(self):
     '''
     Test if it runs a2dissite for the given site.
     '''
     mock = MagicMock(return_value=256)
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(deb_apache.a2dissite('saltstack.com'),
                          {'Name': 'Apache2 Disable Site',
                            'Site': 'saltstack.com',
                             'Status': 'Site saltstack.com Not found'})
Exemple #5
0
 def test_a2dissite_notfound(self):
     '''
     Test if it runs a2dissite for the given site.
     '''
     mock = MagicMock(return_value=256)
     with patch.dict(deb_apache.__salt__, {'cmd.retcode': mock}):
         self.assertEqual(deb_apache.a2dissite('saltstack.com'),
                          {'Name': 'Apache2 Disable Site',
                            'Site': 'saltstack.com',
                             'Status': 'Site saltstack.com Not found'})
Exemple #6
0
 def test_a2dissite(self):
     """
     Test if it runs a2dissite for the given site.
     """
     mock = MagicMock(return_value=2)
     with patch.dict(deb_apache.__salt__, {"cmd.retcode": mock}):
         self.assertEqual(
             deb_apache.a2dissite("saltstack.com"),
             {
                 "Name": "Apache2 Disable Site",
                 "Site": "saltstack.com",
                 "Status": 2
             },
         )