Exemple #1
0
 def test_ping(self, mock_generate_token, mock_api_client):
     mocked_return_value = SumoLogicMockResponse(200, True)
     mock_generate_token.return_value = mocked_return_value
     mock_api_client.return_value = None
     entry_point = EntryPoint(self.connection(), self.configuration())
     ping_result = entry_point.ping_connection()
     assert ping_result["success"] is True
Exemple #2
0
    def test_ping_endpoint_exception(self, mock_generate_token,
                                     mock_api_client):
        mock_api_client.return_value = None
        mocked_return_value = SumoLogicMockResponse(401,
                                                    'Authentication Failure')
        mock_generate_token.return_value = mocked_return_value

        entry_point = EntryPoint(self.connection(), self.configuration())
        ping_response = entry_point.ping_connection()

        assert ping_response['success'] is False
        assert ping_response['connector'] == 'sumologic'
        assert ping_response[
            'error'] == "sumologic connector error => Authentication Failure"
        assert ping_response[
            'code'] == ErrorCode.TRANSMISSION_AUTH_CREDENTIALS.value