# Path: osprofiler/drivers/loginsight.py
# LOG = log.getLogger(__name__)
#     LI_OSPROFILER_AGENT_ID = "F52D775B-6017-4787-8C8A-F21AE0AEC057"
#     SESSIONS_PATH = "api/v1/sessions"
#     CURRENT_SESSIONS_PATH = "api/v1/sessions/current"
#     EVENTS_INGEST_PATH = "api/v1/events/ingest/%s" % LI_OSPROFILER_AGENT_ID
#     QUERY_EVENTS_BASE_PATH = "api/v1/events"
# class LogInsightDriver(base.Driver):
# class LogInsightClient(object):
#     def __init__(
#             self, connection_str, project=None, service=None, host=None,
#             **kwargs):
#     def get_name(cls):
#     def notify(self, info):
#         def _create_field(name, content):
#     def get_report(self, base_id):
#     def __init__(self, host, username, password, api_port=9000,
#                  api_ssl_port=9543, query_timeout=60000):
#     def _build_base_url(self, scheme):
#     def _check_response(self, resp):
#     def _send_request(
#             self, method, scheme, path, headers=None, body=None, params=None):
#     def _get_auth_header(self):
#     def _trunc_session_id(self):
#     def _is_current_session_active(self):
#     def login(self):
#     def send_event(self, event):
#     def query_events(self, params):
#         def _query_events():
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


import json
import ddt
from unittest import mock
from osprofiler.drivers import loginsight
from osprofiler import exc
from osprofiler.tests import test
                                        "content": json.dumps(start_trace)
                                        }
                                       ]
                            },
                           {"text": "OSProfiler trace",
                            "fields": [{"name": "trace",
                                        "content": json.dumps(stop_trace)
                                        }
                                       ]
                            }
                           ]
                }
        self._client.query_events = mock.Mock(return_value=resp)

        self._driver.get_report(self.BASE_ID)
        self._client.query_events.assert_called_once_with({"base_id":
                                                           self.BASE_ID})
        append_results.assert_has_calls(
            [mock.call(start_trace["trace_id"], start_trace["parent_id"],
                       start_trace["name"], start_trace["project"],
                       start_trace["service"], start_trace["info"]["host"],
                       start_trace["timestamp"], start_trace),
             mock.call(stop_trace["trace_id"], stop_trace["parent_id"],
                       stop_trace["name"], stop_trace["project"],
                       stop_trace["service"], stop_trace["info"]["host"],
                       stop_trace["timestamp"], stop_trace)
             ])
        parse_results.assert_called_once_with()



# Path: osprofiler/drivers/loginsight.py
# LOG = log.getLogger(__name__)
#     LI_OSPROFILER_AGENT_ID = "F52D775B-6017-4787-8C8A-F21AE0AEC057"
#     SESSIONS_PATH = "api/v1/sessions"
#     CURRENT_SESSIONS_PATH = "api/v1/sessions/current"
#     EVENTS_INGEST_PATH = "api/v1/events/ingest/%s" % LI_OSPROFILER_AGENT_ID
#     QUERY_EVENTS_BASE_PATH = "api/v1/events"
# class LogInsightDriver(base.Driver):
# class LogInsightClient(object):
#     def __init__(
#             self, connection_str, project=None, service=None, host=None,
#             **kwargs):
#     def get_name(cls):
#     def notify(self, info):
#         def _create_field(name, content):
#     def get_report(self, base_id):
#     def __init__(self, host, username, password, api_port=9000,
#                  api_ssl_port=9543, query_timeout=60000):
#     def _build_base_url(self, scheme):
#     def _check_response(self, resp):
#     def _send_request(
#             self, method, scheme, path, headers=None, body=None, params=None):
#     def _get_auth_header(self):
#     def _trunc_session_id(self):
#     def _is_current_session_active(self):
#     def login(self):
#     def send_event(self, event):
#     def query_events(self, params):
#         def _query_events():
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


# Path: osprofiler/tests/unit/drivers/test_loginsight.py
import json
import ddt
from unittest import mock
from osprofiler.drivers import loginsight
from osprofiler import exc
from osprofiler.tests import test

                                        "content": json.dumps(start_trace)
                                        }
                                       ]
                            },
                           {"text": "OSProfiler trace",
                            "fields": [{"name": "trace",
                                        "content": json.dumps(stop_trace)
                                        }
                                       ]
                            }
                           ]
                }
        self._client.query_events = mock.Mock(return_value=resp)

        self._driver.get_report(self.BASE_ID)
        self._client.query_events.assert_called_once_with({"base_id":
                                                           self.BASE_ID})
        append_results.assert_has_calls(
            [mock.call(start_trace["trace_id"], start_trace["parent_id"],
                       start_trace["name"], start_trace["project"],
                       start_trace["service"], start_trace["info"]["host"],
                       start_trace["timestamp"], start_trace),
             mock.call(stop_trace["trace_id"], stop_trace["parent_id"],
                       stop_trace["name"], stop_trace["project"],
                       stop_trace["service"], stop_trace["info"]["host"],
                       stop_trace["timestamp"], stop_trace)
             ])
        parse_results.assert_called_once_with()



class LogInsightClientTestCase(test.TestCase):