import pytest
from src.config.objects import TargetObject
from src.util.execute_datetime import ExecuteDateTime


class TestTargetObject():

    def test_constructor(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、バリデーションチェックを行いチェックが通ることを確認する
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    # object_name

    def test_raise_constructor_object_name_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、必要なキー(object_name)がない場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「object_name」キーは必須です'

    def test_raise_constructor_object_name_no_value(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(object_name)の値が空文字の場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「object_name」キーは必須です'

    def test_raise_constructor_object_name_none_value(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(object_name)の値がNoneの場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": None,
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「object_name」キーは必須です'

    def test_raise_constructor_object_name_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(object_name)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": 1,
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「object_name」キーの値は「<class \'str\'>」でなければなりません'

    # columns

    def test_raise_constructor_columns_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、必要なキー(columns)がない場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「columns」キーは必須です'

    def test_raise_constructor_columns_no_value(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(columns)の値が空文字の場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": "",
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「columns」キーは必須です'

    def test_raise_constructor_columns_none_value(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(columns)の値がNoneの場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": None,
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「columns」キーは必須です'

    def test_raise_constructor_columns_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(columns)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": False,
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「columns」キーの値は「<class \'list\'>」でなければなりません'

    def test_raise_constructor_columns_no_value_list(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(columns)の値がリスト型で空の場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「columns」キーのリストの値は必須です'

    # is_skip

    def test_raise_constructor_is_skip_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、キー(is_skip)がない場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_is_skip_no_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(is_skip)の値の型が空文字の場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": "",
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_is_skip_none_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(is_skip)の値の型がNoneの場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": None,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_raise_constructor_is_skip_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(is_skip)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": "False",
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「is_skip」キーの値は「<class \'bool\'>」でなければなりません'

    # is_update_last_fetch_datetime

    def test_raise_constructor_is_update_last_fetch_datetime_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、キー(is_update_last_fetch_datetime)がない場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_is_update_last_fetch_datetime_no_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(is_update_last_fetch_datetime)の値の型が空文字の場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": "",
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_is_update_last_fetch_datetime_none_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(is_update_last_fetch_datetime)の値の型がNoneの場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": None,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_raise_constructor_is_update_last_fetch_datetime_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(is_update_last_fetch_datetime)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": "False",
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「is_update_last_fetch_datetime」キーの値は「<class \'bool\'>」でなければなりません'

    # last_fetch_datetime_file_name

    def test_raise_constructor_last_fetch_datetime_file_name_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、キー(last_fetch_datetime_file_name)がない場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_last_fetch_datetime_file_name_no_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(last_fetch_datetime_file_name)の値の型が空文字の場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_last_fetch_datetime_file_name_none_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(last_fetch_datetime_file_name)の値の型がNoneの場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": None,
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_raise_constructor_last_fetch_datetime_file_name_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(last_fetch_datetime_file_name)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": 1,
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「last_fetch_datetime_file_name」キーの値は「<class \'str\'>」でなければなりません'

    # upload_file_name

    def test_raise_constructor_upload_file_name_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、キー(upload_file_name)がない場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_upload_file_name_no_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(upload_file_name)の値の型が空文字の場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_upload_file_name_none_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(upload_file_name)の値の型がNoneの場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": None,
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_raise_constructor_upload_file_name_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(upload_file_name)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": 1,
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「upload_file_name」キーの値は「<class \'str\'>」でなければなりません'

    # datetime_column

    def test_raise_constructor_datetime_column_no_key(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータに対して、キー(datetime_column)がない場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_datetime_column_no_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(datetime_column)の値の型が空文字の場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": ""
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_constructor_datetime_column_none_value(self) -> None:
        """
        Cases:
            辞書型のデータの対象のキー(datetime_column)の値の型がNoneの場合、例外が発生しないこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生しないこと
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": None
        }

        execute_datetime = ExecuteDateTime()

        # Act
        TargetObject(object_info, execute_datetime)

        # Expects
        pass

    def test_raise_constructor_datetime_column_other_type(self) -> None:
        """
        Cases:
            インスタンス生成テスト
            辞書型のデータの対象のキー(datetime_column)の値の型が想定と違う場合、例外が発生すること
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
        Expects:
            - 例外が発生し期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": False,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": 1
        }

        execute_datetime = ExecuteDateTime()

        # Act
        with pytest.raises(Exception) as e:
            TargetObject(object_info, execute_datetime)

        # Expects
        assert str(e.value) == '「datetime_column」キーの値は「<class \'str\'>」でなければなりません'

    # property

    def test_object_name(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.object_name

        # Expects
        assert actual == 'AccountShare'

    def test_columns(self) -> list:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.columns

        # Expects
        expected_value = [
            "Id",
            "AccountId",
            "UserOrGroupId",
            "AccountAccessLevel",
            "OpportunityAccessLevel",
            "CaseAccessLevel",
            "ContactAccessLevel",
            "RowCause",
            "LastModifiedDate",
            "LastModifiedById",
            "IsDeleted"
        ]
        assert actual == expected_value

    def test_is_skip(self) -> bool:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.is_skip

        # Expects
        assert actual is True

    def test_is_skip_default(self) -> bool:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": "",
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.is_skip

        # Expects
        assert actual is False

    def test_is_update_last_fetch_datetime(self) -> bool:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.is_update_last_fetch_datetime

        # Expects
        assert actual is False

    def test_is_update_last_fetch_datetime_default(self) -> bool:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": "",
            "last_fetch_datetime_file_name": "AccountShare.json",
            "upload_file_name": "CRM_AccountShare",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.is_update_last_fetch_datetime

        # Expects
        assert actual is True

    def test_last_fetch_datetime_file_name(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare_Test.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.last_fetch_datetime_file_name

        # Expects
        assert actual == 'AccountShare_Test.json'

    def test_last_fetch_datetime_file_name_default(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "",
            "upload_file_name": "CRM_AccountShare",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.last_fetch_datetime_file_name

        # Expects
        assert actual == 'AccountShare.json'

    def test_upload_file_name(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare_Test.json",
            "upload_file_name": "CRM_AccountShare_Test_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.upload_file_name

        # Expects
        assert actual == f'CRM_AccountShare_Test_{execute_datetime.format_date()}'

    def test_upload_file_name_default(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare_Test.json",
            "upload_file_name": "",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.upload_file_name

        # Expects
        assert actual == f'CRM_AccountShare_{execute_datetime.format_date()}'

    def test_datetime_column(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare_Test.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": "LastModifiedDate"
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.datetime_column

        # Expects
        assert actual == 'LastModifiedDate'

    def test_datetime_column_default(self) -> str:
        """
        Cases:
            オブジェクト情報から対象の値を返すこと
        Arranges:
            - 辞書型のオブジェクト情報を準備する
            - 実行日時インスタンスを生成する
            - オブジェクト情報インスタンスを生成する
        Expects:
            - 戻り値が期待値と一致する
        """

        # Arranges
        object_info = {
            "object_name": "AccountShare",
            "columns": [
                "Id",
                "AccountId",
                "UserOrGroupId",
                "AccountAccessLevel",
                "OpportunityAccessLevel",
                "CaseAccessLevel",
                "ContactAccessLevel",
                "RowCause",
                "LastModifiedDate",
                "LastModifiedById",
                "IsDeleted"
            ],
            "is_skip": True,
            "is_update_last_fetch_datetime": False,
            "last_fetch_datetime_file_name": "AccountShare_Test.json",
            "upload_file_name": "CRM_AccountShare_{execute_datetime}",
            "datetime_column": ""
        }

        execute_datetime = ExecuteDateTime()

        sut = TargetObject(object_info, execute_datetime)

        # Act
        actual = sut.datetime_column

        # Expects
        assert actual == 'SystemModstamp'
