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
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)
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'
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'
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)
def test_detect_complete_fail(root): with pytest.raises(ChangelogError): PathsConfig.detect()