# coding: utf-8

"""
    Airflow API

    Airflow API. All endpoints located under ``/api/v2`` can be used safely, are stable and backward compatible. Endpoints located under ``/ui`` are dedicated to the UI and are subject to breaking change depending on the need of the frontend. Users should not rely on those but use the public ones instead.

    The version of the OpenAPI document: 2
    Generated by OpenAPI Generator (https://openapi-generator.tech)

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


import unittest

from airflow_client.client.models.task_collection_response import TaskCollectionResponse

class TestTaskCollectionResponse(unittest.TestCase):
    """TaskCollectionResponse unit test stubs"""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def make_instance(self, include_optional) -> TaskCollectionResponse:
        """Test TaskCollectionResponse
            include_optional is a boolean, when False only required
            params are included, when True both required and
            optional params are included """
        # uncomment below to create an instance of `TaskCollectionResponse`
        """
        model = TaskCollectionResponse()
        if include_optional:
            return TaskCollectionResponse(
                tasks = [
                    airflow_client.client.models.task_response.TaskResponse(
                        class_ref = airflow_client.client.models.extra.extra(), 
                        depends_on_past = True, 
                        doc_md = '', 
                        downstream_task_ids = [
                            ''
                            ], 
                        end_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), 
                        execution_timeout = airflow_client.client.models.time_delta.TimeDelta(
                            __type = 'TimeDelta', 
                            days = 56, 
                            microseconds = 56, 
                            seconds = 56, ), 
                        extra_links = [
                            ''
                            ], 
                        is_mapped = True, 
                        operator_name = '', 
                        owner = '', 
                        params = airflow_client.client.models.extra.extra(), 
                        pool = '', 
                        pool_slots = 1.337, 
                        priority_weight = 1.337, 
                        queue = '', 
                        retries = 1.337, 
                        retry_delay = airflow_client.client.models.time_delta.TimeDelta(
                            __type = 'TimeDelta', 
                            days = 56, 
                            microseconds = 56, 
                            seconds = 56, ), 
                        retry_exponential_backoff = True, 
                        start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), 
                        task_display_name = '', 
                        task_id = '', 
                        template_fields = [
                            ''
                            ], 
                        trigger_rule = '', 
                        ui_color = '', 
                        ui_fgcolor = '', 
                        wait_for_downstream = True, 
                        weight_rule = '', )
                    ],
                total_entries = 56
            )
        else:
            return TaskCollectionResponse(
                tasks = [
                    airflow_client.client.models.task_response.TaskResponse(
                        class_ref = airflow_client.client.models.extra.extra(), 
                        depends_on_past = True, 
                        doc_md = '', 
                        downstream_task_ids = [
                            ''
                            ], 
                        end_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), 
                        execution_timeout = airflow_client.client.models.time_delta.TimeDelta(
                            __type = 'TimeDelta', 
                            days = 56, 
                            microseconds = 56, 
                            seconds = 56, ), 
                        extra_links = [
                            ''
                            ], 
                        is_mapped = True, 
                        operator_name = '', 
                        owner = '', 
                        params = airflow_client.client.models.extra.extra(), 
                        pool = '', 
                        pool_slots = 1.337, 
                        priority_weight = 1.337, 
                        queue = '', 
                        retries = 1.337, 
                        retry_delay = airflow_client.client.models.time_delta.TimeDelta(
                            __type = 'TimeDelta', 
                            days = 56, 
                            microseconds = 56, 
                            seconds = 56, ), 
                        retry_exponential_backoff = True, 
                        start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), 
                        task_display_name = '', 
                        task_id = '', 
                        template_fields = [
                            ''
                            ], 
                        trigger_rule = '', 
                        ui_color = '', 
                        ui_fgcolor = '', 
                        wait_for_downstream = True, 
                        weight_rule = '', )
                    ],
                total_entries = 56,
        )
        """

    def testTaskCollectionResponse(self):
        """Test TaskCollectionResponse"""
        # inst_req_only = self.make_instance(include_optional=False)
        # inst_req_and_optional = self.make_instance(include_optional=True)

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