def __fetch_metadata(self, name): for artifact_id in name.artifact_id_variations: response = self.__http_get_metadata(name.group_path, artifact_id) if response.status_code != 404: break response.raise_for_status() return MavenMetadata.parse(response.text)
def test_parse_valid_xml_without_latest_tag_and_not_sorted_versions(): xml = dedent('''\ <?xml version="1.0" encoding="UTF-8"?> <metadata> <groupId>org.spire-math</groupId> <artifactId>kind-projector_2.10</artifactId> <versioning> <versions> <version>0.9.3</version> <version>0.6.3</version> <version>0.7.0</version> <version>0.8.1</version> <version>0.7.1</version> <version>0.8.0</version> <version>0.9.4</version> <version>0.9.0</version> <version>0.9.2</version> <version>0.8.2</version> </versions> <lastUpdated>20170530144248</lastUpdated> </versioning> </metadata> ''') metadata = MavenMetadata.parse(xml) assert metadata.latest_version == '0.9.4'