示例#1
0
def test_config_store_collection(collection_config_path):
    collection_config_path.write_text('')
    paths = PathsConfig.detect()
    collection_details = CollectionDetails(paths)

    config = ChangelogConfig.default(paths, collection_details)
    assert config.flatmap is None

    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.flatmap is None

    config.always_refresh = True
    config.flatmap = True
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh is True
    assert config.flatmap is True

    config.always_refresh = False
    config.flatmap = False
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh is False
    assert config.flatmap is False
示例#2
0
def test_config_loading_bad_keep_fragments(ansible_config_path):
    ansible_config_path.write_text(
        'changes_format: classic\nkeep_fragments: false')
    paths = PathsConfig.detect()
    collection_details = CollectionDetails(paths)
    with pytest.raises(ChangelogError):
        ChangelogConfig.load(paths, collection_details)
示例#3
0
def test_config_store_ansible(ansible_config_path):
    ansible_config_path.write_text('')
    paths = PathsConfig.detect()
    collection_details = CollectionDetails(paths)

    config = ChangelogConfig.default(paths, collection_details)
    config.always_refresh = 'none'
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh == 'none'

    config.always_refresh = False
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh == 'none'

    config.always_refresh = 'full'
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh == 'full'

    config.always_refresh = True
    config.store()
    config = ChangelogConfig.load(paths, collection_details)
    assert config.always_refresh == 'full'
示例#4
0
def test_detect_ansible_no_doc_binary(cwd_tmp_path):
    d = cwd_tmp_path / 'lib'
    d.mkdir()
    d = d / 'ansible'
    d.mkdir()
    d = cwd_tmp_path / 'bin'
    d.mkdir()
    d = cwd_tmp_path / 'changelogs'
    d.mkdir()
    (d / 'config.yaml').write_text('---')
    c = PathsConfig.detect()
    assert c.ansible_doc_path == 'ansible-doc'
示例#5
0
def test_config_loading_bad_changes_format(collection_config_path):
    collection_config_path.write_text('changes_format: other')
    paths = PathsConfig.detect()
    collection_details = CollectionDetails(paths)
    with pytest.raises(ChangelogError):
        ChangelogConfig.load(paths, collection_details)
示例#6
0
def test_detect_complete_fail(root):
    with pytest.raises(ChangelogError):
        PathsConfig.detect()