def test_generate_example(hook_client):
    hook_target_info = {
        "AWS::Example::Target": {
            "TypeName": "AWS::Example::Target",
            "Schema": {
                "properties": {
                    "a": {
                        "type": "number",
                        "const": 1
                    },
                    "b": {
                        "type": "number",
                        "const": 2
                    },
                },
                "readOnlyProperties": ["/properties/b"],
            },
        }
    }
    hook_client._target_info = HookClient._setup_target_info(hook_target_info)
    assert not hook_client._target_info["AWS::Example::Target"].get(
        "SchemaStrategy")

    example = hook_client._generate_target_example("AWS::Example::Target")
    assert example == {"a": 1}
    assert hook_client._target_info["AWS::Example::Target"]["SchemaStrategy"]
def test_generate_update_example(hook_client):
    hook_target_info = {
        "AWS::Example::Target": {
            "TypeName": "AWS::Example::Target",
            "Schema": {
                "properties": {
                    "a": {
                        "type": "number",
                        "const": 1
                    },
                    "b": {
                        "type": "number",
                        "const": 2
                    },
                    "c": {
                        "type": "number",
                        "const": 3
                    },
                },
                "readOnlyProperties": ["/properties/b"],
                "createOnlyProperties": ["/properties/c"],
            },
        }
    }
    hook_client._target_info = HookClient._setup_target_info(hook_target_info)
    hook_client._overrides = {}
    assert not hook_client._target_info["AWS::Example::Target"].get(
        "UpdateSchemaStrategy")

    model = {"b": 2, "a": 4}
    example = hook_client._generate_target_update_example(
        "AWS::Example::Target", model)
    assert example == {"a": 1, "b": 2}
    assert hook_client._target_info["AWS::Example::Target"][
        "UpdateSchemaStrategy"]
def test_setup_target_info():
    hook_target_info = {
        "AWS::Example::Target": {
            "TypeName": "AWS::Example::Target",
            "Schema": TARGET_SCHEMA,
        }
    }

    target_info = HookClient._setup_target_info(hook_target_info)

    assert target_info["AWS::Example::Target"]["readOnlyProperties"] == {
        ("properties", "b")
    }
    assert target_info["AWS::Example::Target"]["createOnlyProperties"] == {
        ("properties", "c")
    }