# coding: utf-8

"""
    BeeKeeperAI EscrowAI Enclave API

    Described below is the EscrowAI Enclave API that provides functionality inside a BeeKeeperAI environment. Included are data engineering endpoints and reporting endpoints.

    The version of the OpenAPI document: 1.5.0
    Contact: engineering@beekeeperai.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import unittest
from unittest.mock import create_autospec, patch, MagicMock

import BeeKeeperRuntimeSDK
from BeeKeeperRuntimeSDK.api.report_api import ReportApi  # noqa: E501
from BeeKeeperRuntimeSDK.rest import ApiException

from BeeKeeperRuntimeSDK.models.report import Report
from BeeKeeperRuntimeSDK.models.report_post200_response import ReportPost200Response


class TestReportApi(unittest.TestCase):
    """ReportApi unit test stubs"""

    @patch.object(
        BeeKeeperRuntimeSDK.api.report_api.ApiClient,
        "get_default",
        return_value=MagicMock(spec=BeeKeeperRuntimeSDK.api.report_api.ApiClient),
        autospec=True
    )
    def setUp(self, mock_client):
        self.api = BeeKeeperRuntimeSDK.api.report_api.ReportApi()  # noqa: E501
        self.mock_api_client = mock_client
        self.test_report = Report(
            name="Test Report",
            status="In Progress",
            json_data="eyJrZXkiOiAiVmFsdWUifQ",
            upload_location="data",
            project="f47ac10b-58cc-4372-a567-0e02b2c3d479",
            run_configuration="f47ac10b-58cc-4372-kf67-0e02b2c3d479",
            run="f47ac10b-58cc-4372-a567-0e02b2fh4479"
        )

    def tearDown(self):
        pass

    def test_report_post(self):
        """Test case for report_post

        Post a valid report  # noqa: E501
        """
        report = MagicMock(spec=Report)
        self.mock_api_client.return_value.call_api.return_value = MagicMock(spec=ReportPost200Response)
        response = self.api.report_post(self.test_report)
        self.mock_api_client.return_value.call_api.assert_called()
        args, kwargs = self.mock_api_client.return_value.call_api.call_args
        assert args[0] == '/report'
        assert args[1] == 'POST'
        assert kwargs.get('body') == self.test_report
        assert isinstance(response, ReportPost200Response)

    def test_validate_post(self):
        """Test case for validate_post

        Validate a report  # noqa: E501
        """
        report = MagicMock(spec=Report)
        self.mock_api_client.return_value.call_api.return_value = MagicMock(spec=ReportPost200Response)
        response = self.api.validate_post(self.test_report)
        self.mock_api_client.return_value.call_api.assert_called()
        args, kwargs = self.mock_api_client.return_value.call_api.call_args
        assert args[0] == '/validate'
        assert args[1] == 'POST'
        assert kwargs.get('body') == self.test_report
        assert isinstance(response, ReportPost200Response)


if __name__ == '__main__':
    unittest.main()
