Пример #1
0
 def test_server_status(self):
     '''
     Test if return get information from the Apache server-status
     '''
     mock = MagicMock(return_value='')
     with patch.dict(apache.__salt__, {'config.get': mock}):
         self.assertEqual(apache.server_status(), {})
Пример #2
0
 def test_server_status(self):
     '''
     Test if return get information from the Apache server-status
     '''
     mock = MagicMock(return_value='')
     with patch.dict(apache.__salt__, {'config.get': mock}):
         self.assertEqual(apache.server_status(), {})
Пример #3
0
 def test_server_status(self):
     """
     Test if return get information from the Apache server-status
     """
     with patch("salt.modules.apache.server_status", MagicMock(return_value={})):
         mock = MagicMock(return_value="")
         with patch.dict(apache.__salt__, {"config.get": mock}):
             assert apache.server_status() == {}
Пример #4
0
 def test_server_status_error(self):
     '''
     Test if return get error from the Apache server-status
     '''
     mock = MagicMock(side_effect=URLError('error'))
     with patch.object(apache, '_urlopen', mock):
         mock = MagicMock(return_value='')
         with patch.dict(apache.__salt__, {'config.get': mock}):
             self.assertEqual(apache.server_status(), 'error')
Пример #5
0
 def test_server_status_error(self):
     """
     Test if return get error from the Apache server-status
     """
     mock = MagicMock(side_effect=urllib.error.URLError("error"))
     with patch("urllib.request.urlopen", mock):
         mock = MagicMock(return_value="")
         with patch.dict(apache.__salt__, {"config.get": mock}):
             assert apache.server_status() == "error"
Пример #6
0
 def test_server_status(self):
     '''
     Test if return get information from the Apache server-status
     '''
     with patch('salt.modules.apache.server_status',
                MagicMock(return_value={})):
         mock = MagicMock(return_value='')
         with patch.dict(apache.__salt__, {'config.get': mock}):
             assert apache.server_status() == {}
Пример #7
0
 def test_server_status_error(self):
     '''
     Test if return get error from the Apache server-status
     '''
     mock = MagicMock(side_effect=URLError('error'))
     with patch.object(apache, '_urlopen', mock):
         mock = MagicMock(return_value='')
         with patch.dict(apache.__salt__, {'config.get': mock}):
             self.assertEqual(apache.server_status(), 'error')