예제 #1
0
def test_config_default() -> None:
    file_path = load_config_fixture("v1-default.toml")
    loaded = toml.load(file_path)
    actual = V1.parse_obj(cast(Dict[Any, Any], loaded))
    expected = V1(version=1)

    assert actual == expected
예제 #2
0
def test_config_parsing_opposite() -> None:
    """
    parse config with all opposite settings so we can ensure the config is
    correctly formatted.
    """
    file_path = load_config_fixture("v1-opposite.toml")
    loaded = toml.load(file_path)
    actual = V1.parse_obj(cast(Dict[Any, Any], loaded))

    expected = V1(
        version=1,
        app_id="12345",
        merge=Merge(
            automerge_label="mergeit!",
            require_automerge_label=False,
            blacklist_title_regex="",
            blacklist_labels=["wip", "block-merge"],
            method=MergeMethod.squash,
            delete_branch_on_merge=True,
            block_on_reviews_requested=True,
            notify_on_conflict=False,
            optimistic_updates=False,
            message=MergeMessage(
                title=MergeTitleStyle.pull_request_title,
                body=MergeBodyStyle.pull_request_body,
                include_pr_number=False,
                body_type=BodyText.plain_text,
                strip_html_comments=True,
            ),
        ),
    )

    assert actual == expected
예제 #3
0
def test_config_parsing_opposite(config_fixture_name: str, expected_config: V1) -> None:
    """
    parse config with all opposite settings so we can ensure the config is
    correctly formatted.
    """
    file_path = load_config_fixture(config_fixture_name)
    loaded = toml.load(file_path)
    actual = V1.parse_obj(cast(Dict[Any, Any], loaded))

    assert actual == expected_config