# 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.bulk_update_action_variable_body import BulkUpdateActionVariableBody

class TestBulkUpdateActionVariableBody(unittest.TestCase):
    """BulkUpdateActionVariableBody unit test stubs"""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def make_instance(self, include_optional) -> BulkUpdateActionVariableBody:
        """Test BulkUpdateActionVariableBody
            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 `BulkUpdateActionVariableBody`
        """
        model = BulkUpdateActionVariableBody()
        if include_optional:
            return BulkUpdateActionVariableBody(
                action = 'create',
                action_on_non_existence = 'fail',
                entities = [
                    airflow_client.client.models.variable_body.VariableBody(
                        description = '', 
                        key = '', 
                        value = null, )
                    ]
            )
        else:
            return BulkUpdateActionVariableBody(
                action = 'create',
                entities = [
                    airflow_client.client.models.variable_body.VariableBody(
                        description = '', 
                        key = '', 
                        value = null, )
                    ],
        )
        """

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

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