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_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_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 set_config_raw(self, config: bytes): self.mkdir(self.paths.changelog_dir) self._write(self.paths.config_path, config) self.config = ChangelogConfig.load(self.paths, CollectionDetails(self.paths))
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)