diff --git a/lib/datasource/nuget/index.js b/lib/datasource/nuget/index.js index a7ce78dd3683c9b238dd274b7f531e092f2866d9..1bbbd0b1e8116be998d40b53c23fcc01184435f9 100644 --- a/lib/datasource/nuget/index.js +++ b/lib/datasource/nuget/index.js @@ -1,51 +1,203 @@ const parse = require('github-url-from-git'); const { XmlDocument } = require('xmldoc'); - +const urlApi = require('url'); const got = require('../../util/got'); module.exports = { getPkgReleases, }; -async function getPkgReleases({ lookupName }) { +const defaultNugetFeed = 'https://api.nuget.org/v3/index.json'; + +async function getPkgReleases({ lookupName, registryUrls }) { logger.trace(`nuget.getPkgReleases(${lookupName})`); - const pkgUrl = `https://api.nuget.org/v3-flatcontainer/${lookupName.toLowerCase()}/index.json`; + let dep = null; + // https://api.nuget.org/v3/index.json is a default official nuget feed + const feeds = registryUrls === null ? [defaultNugetFeed] : registryUrls; + for (const feed of feeds) { + if (dep != null) break; + + const feedVersion = detectFeedVersion(feed); + if (feedVersion !== null) { + if (feedVersion === 3) { + const queryUrl = await getQueryUrlForV3Feed(feed); + if (queryUrl !== null) { + dep = await getPkgReleasesFromV3Feed(feed, queryUrl, lookupName); + } + } else if (feedVersion === 2) { + dep = await getPkgReleasesFromV2Feed(feed, lookupName); + } + } + } + if (dep != null) { + return dep; + } + + logger.info( + { lookupName }, + `Dependency lookup failure: not found in all feeds` + ); + return null; +} + +async function getPkgReleasesFromV3Feed(registryUrl, feedUrl, pkgName) { + const queryUrl = `${feedUrl}?q=PackageId:${pkgName}`; + const dep = { + pkgName, + }; try { - const res = (await got(pkgUrl, { - json: true, - retry: 5, - })).body; - const dep = { - name: lookupName, - }; - dep.releases = (res.versions || []).map(version => ({ version })); - // look up nuspec for latest release to get repository - const url = `https://api.nuget.org/v3-flatcontainer/${lookupName.toLowerCase()}/${res.versions.pop()}/${lookupName.toLowerCase()}.nuspec`; + const pkgUrlListRaw = await got(queryUrl, { retry: 5, json: true }); + if (pkgUrlListRaw.statusCode !== 200) { + logger.debug( + { dependency: pkgName, pkgUrlListRaw }, + `nuget registry failure: status code != 200` + ); + return null; + } + + // There are no pkgName is current feed + if (pkgUrlListRaw.body.totalHits === 0) { + return null; + } + + dep.releases = (pkgUrlListRaw.body.data[0].versions || []).map(item => ({ + version: item.version, + })); + try { - const result = await got(url); - const nuspec = new XmlDocument(result.body); - if (nuspec) { - const sourceUrl = parse( - nuspec.valueWithPath('metadata.repository@url') - ); - if (sourceUrl) { - dep.sourceUrl = sourceUrl; + // For nuget.org we have a way to get nuspec file + if (registryUrl.toLowerCase() === defaultNugetFeed.toLowerCase()) { + const nugetOrgApi = `https://api.nuget.org/v3-flatcontainer/${pkgName.toLowerCase()}/${ + [...dep.releases].pop().version + }/${pkgName.toLowerCase()}.nuspec`; + const result = await got(nugetOrgApi); + const nuspec = new XmlDocument(result.body); + if (nuspec) { + const sourceUrl = parse( + nuspec.valueWithPath('metadata.repository@url') + ); + if (sourceUrl) { + dep.sourceUrl = sourceUrl; + } } + } else if ( + Object.prototype.hasOwnProperty.call( + pkgUrlListRaw.body.data[0], + 'projectUrl' + ) + ) { + dep.sourceUrl = parse(pkgUrlListRaw.body.data[0].projectUrl); } } catch (err) /* istanbul ignore next */ { - logger.debug({ lookupName }, 'Error looking up nuspec'); + logger.debug( + { err, pkgName, feedUrl }, + `nuget registry failure: can't parse pkg info for project url` + ); + } + + return dep; + } catch (err) { + logger.debug( + { err, pkgName, feedUrl }, + 'nuget registry failure: Unknown error' + ); + return null; + } +} + +async function getPkgReleasesFromV2Feed(feedUrl, pkgName) { + const pkgUrlList = `${feedUrl}/FindPackagesById()?id=%27${pkgName}%27&$orderby=LastUpdated%20desc&$select=Version`; + const pkgUrl = `${feedUrl}/FindPackagesById()?id=%27${pkgName}%27&$orderby=LastUpdated%20desc&$top=1`; + const dep = { + pkgName, + }; + try { + const pkgVersionsListRaw = await got(pkgUrlList, { retry: 5 }); + const pkgLatestRaw = await got(pkgUrl, { retry: 5 }); + if (pkgVersionsListRaw.statusCode !== 200) { + logger.debug( + { dependency: pkgName, pkgVersionsListRaw }, + `nuget registry failure: status code != 200` + ); + return null; + } + if (pkgLatestRaw.statusCode !== 200) { + logger.debug( + { dependency: pkgName, pkgVersionsListRaw }, + `nuget registry failure: status code != 200` + ); + return null; + } + const pkgInfoList = new XmlDocument( + pkgVersionsListRaw.body + ).children.filter(node => node.name === 'entry'); + + dep.releases = (pkgInfoList || []) + .map(info => info.children.find(child => child.name === 'm:properties')) + .map(item => ({ + version: item.children.find(child => child.name === 'd:Version').val, + })); + + try { + const pkgInfo = new XmlDocument(pkgLatestRaw.body).children.filter( + node => node.name === 'entry' + )[0]; + dep.sourceUrl = parse( + pkgInfo.children + .filter(child => child.name === 'm:properties')[0] + .children.filter(child => child.name === 'd:ProjectUrl')[0].val + ); + } catch (err) /* istanbul ignore next */ { + logger.debug( + { err, pkgName, feedUrl }, + `nuget registry failure: can't parse pkg info for project url` + ); } - logger.trace({ dep }, 'dep'); + return dep; } catch (err) { - if (err.statusCode === 404 || err.code === 'ENOTFOUND') { - logger.info({ lookupName }, `Dependency lookup failure: not found`); - logger.debug({ - err, - }); + logger.debug( + { err, pkgName, feedUrl }, + 'nuget registry failure: Unknown error' + ); + return null; + } +} + +function detectFeedVersion(url) { + try { + const parsecUrl = urlApi.parse(url); + // Official client does it in the same way + if (parsecUrl.pathname.endsWith('.json')) { + return 3; + } + return 2; + } catch (e) { + logger.debug({ e }, `nuget registry failure: can't parse ${url}`); + return null; + } +} + +async function getQueryUrlForV3Feed(url) { + // https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource + try { + const servicesIndexRaw = await got(url, { retry: 5, json: true }); + if (servicesIndexRaw.statusCode !== 200) { + logger.debug( + { dependency: url, servicesIndexRaw }, + `nuget registry failure: status code != 200` + ); return null; } - logger.warn({ err, lookupName }, 'nuget registry failure: Unknown error'); + const searchQueryService = servicesIndexRaw.body.resources.find( + resource => resource['@type'] === 'SearchQueryService' + ); + return searchQueryService['@id']; + } catch (e) { + logger.debug( + { e }, + `nuget registry failure: can't get SearchQueryService form ${url}` + ); return null; } } diff --git a/test/_fixtures/nuget/indexV3.json b/test/_fixtures/nuget/indexV3.json new file mode 100644 index 0000000000000000000000000000000000000000..dcb3a70b2dc90f1e25402d416431730bf3119fc0 --- /dev/null +++ b/test/_fixtures/nuget/indexV3.json @@ -0,0 +1,167 @@ +{ + "version": "3.0.0", + "resources": [ + { + "@id": "https://api-v2v3search-0.nuget.org/query", + "@type": "SearchQueryService", + "comment": "Query endpoint of NuGet Search service (primary)" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/query", + "@type": "SearchQueryService", + "comment": "Query endpoint of NuGet Search service (secondary)" + }, + { + "@id": "https://api-v2v3search-0.nuget.org/autocomplete", + "@type": "SearchAutocompleteService", + "comment": "Autocomplete endpoint of NuGet Search service (primary)" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/autocomplete", + "@type": "SearchAutocompleteService", + "comment": "Autocomplete endpoint of NuGet Search service (secondary)" + }, + { + "@id": "https://api-v2v3search-0.nuget.org/", + "@type": "SearchGalleryQueryService/3.0.0-rc", + "comment": "Azure Website based Search Service used by Gallery (primary)" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/", + "@type": "SearchGalleryQueryService/3.0.0-rc", + "comment": "Azure Website based Search Service used by Gallery (secondary)" + }, + { + "@id": "https://api.nuget.org/v3/registration3/", + "@type": "RegistrationsBaseUrl", + "comment": "Base URL of Azure storage where NuGet package registration info is stored" + }, + { + "@id": "https://api.nuget.org/v3-flatcontainer/", + "@type": "PackageBaseAddress/3.0.0", + "comment": "Base URL of where NuGet packages are stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg" + }, + { + "@id": "https://www.nuget.org/api/v2", + "@type": "LegacyGallery" + }, + { + "@id": "https://www.nuget.org/api/v2", + "@type": "LegacyGallery/2.0.0" + }, + { + "@id": "https://www.nuget.org/api/v2/package", + "@type": "PackagePublish/2.0.0" + }, + { + "@id": "https://www.nuget.org/api/v2/symbolpackage", + "@type": "SymbolPackagePublish/4.9.0", + "comment": "The gallery symbol publish endpoint." + }, + { + "@id": "https://api-v2v3search-0.nuget.org/query", + "@type": "SearchQueryService/3.0.0-rc", + "comment": "Query endpoint of NuGet Search service (primary) used by RC clients" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/query", + "@type": "SearchQueryService/3.0.0-rc", + "comment": "Query endpoint of NuGet Search service (secondary) used by RC clients" + }, + { + "@id": "https://api-v2v3search-0.nuget.org/autocomplete", + "@type": "SearchAutocompleteService/3.0.0-rc", + "comment": "Autocomplete endpoint of NuGet Search service (primary) used by RC clients" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/autocomplete", + "@type": "SearchAutocompleteService/3.0.0-rc", + "comment": "Autocomplete endpoint of NuGet Search service (secondary) used by RC clients" + }, + { + "@id": "https://api.nuget.org/v3/registration3/", + "@type": "RegistrationsBaseUrl/3.0.0-rc", + "comment": "Base URL of Azure storage where NuGet package registration info is stored used by RC clients. This base URL does not include SemVer 2.0.0 packages." + }, + { + "@id": "https://www.nuget.org/packages/{id}/{version}/ReportAbuse", + "@type": "ReportAbuseUriTemplate/3.0.0-rc", + "comment": "URI template used by NuGet Client to construct Report Abuse URL for packages used by RC clients" + }, + { + "@id": "https://api.nuget.org/v3/registration3/{id-lower}/index.json", + "@type": "PackageDisplayMetadataUriTemplate/3.0.0-rc", + "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID" + }, + { + "@id": "https://api.nuget.org/v3/registration3/{id-lower}/{version-lower}.json", + "@type": "PackageVersionDisplayMetadataUriTemplate/3.0.0-rc", + "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID, Version" + }, + { + "@id": "https://api-v2v3search-0.nuget.org/query", + "@type": "SearchQueryService/3.0.0-beta", + "comment": "Query endpoint of NuGet Search service (primary) used by beta clients" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/query", + "@type": "SearchQueryService/3.0.0-beta", + "comment": "Query endpoint of NuGet Search service (secondary) used by beta clients" + }, + { + "@id": "https://api-v2v3search-0.nuget.org/autocomplete", + "@type": "SearchAutocompleteService/3.0.0-beta", + "comment": "Autocomplete endpoint of NuGet Search service (primary) used by beta clients" + }, + { + "@id": "https://api-v2v3search-1.nuget.org/autocomplete", + "@type": "SearchAutocompleteService/3.0.0-beta", + "comment": "Autocomplete endpoint of NuGet Search service (secondary) used by beta clients" + }, + { + "@id": "https://api.nuget.org/v3/registration3/", + "@type": "RegistrationsBaseUrl/3.0.0-beta", + "comment": "Base URL of Azure storage where NuGet package registration info is stored used by Beta clients. This base URL does not include SemVer 2.0.0 packages." + }, + { + "@id": "https://www.nuget.org/packages/{id}/{version}/ReportAbuse", + "@type": "ReportAbuseUriTemplate/3.0.0-beta", + "comment": "URI template used by NuGet Client to construct Report Abuse URL for packages" + }, + { + "@id": "https://api.nuget.org/v3/registration3-gz/", + "@type": "RegistrationsBaseUrl/3.4.0", + "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL does not include SemVer 2.0.0 packages." + }, + { + "@id": "https://api.nuget.org/v3/registration3-gz-semver2/", + "@type": "RegistrationsBaseUrl/3.6.0", + "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages." + }, + { + "@id": "https://api.nuget.org/v3/registration3-gz-semver2/", + "@type": "RegistrationsBaseUrl/Versioned", + "clientVersion": "4.3.0-alpha", + "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages." + }, + { + "@id": "https://api.nuget.org/v3-index/repository-signatures/4.7.0/index.json", + "@type": "RepositorySignatures/4.7.0", + "comment": "The endpoint for discovering information about this package source's repository signatures." + }, + { + "@id": "https://api.nuget.org/v3-index/repository-signatures/4.9.0/index.json", + "@type": "RepositorySignatures/4.9.0", + "comment": "The endpoint for discovering information about this package source's repository signatures." + }, + { + "@id": "https://api.nuget.org/v3/catalog0/index.json", + "@type": "Catalog/3.0.0", + "comment": "Index of the NuGet package catalog." + } + ], + "@context": { + "@vocab": "http://schema.nuget.org/services#", + "comment": "http://www.w3.org/2000/01/rdf-schema#comment" + } +} diff --git a/test/_fixtures/nuget/latestV2.json b/test/_fixtures/nuget/latestV2.json new file mode 100644 index 0000000000000000000000000000000000000000..438d974c1a149cb75a381d3255b1d0a4c29be356 --- /dev/null +++ b/test/_fixtures/nuget/latestV2.json @@ -0,0 +1,42 @@ +{ + "d": { + "results": [ + { + "Id": "Newtonsoft.Json", + "Version": "11.0.2", + "Title": "Json.NET", + "Authors": "James Newton-King", + "RequireLicenseAcceptance": false, + "Description": "Json.NET is a popular high-performance JSON framework for .NET", + "ReleaseNotes": "", + "Summary": "", + "ProjectUrl": "https://www.newtonsoft.com/json", + "IconUrl": "https://www.newtonsoft.com/content/images/nugeticon.png", + "LicenseUrl": "https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md", + "Copyright": "Copyright © James Newton-King 2008", + "Tags": "json", + "Dependencies": "::.NETFramework2.0|::.NETFramework3.5|::.NETFramework4.0|::.NETFramework4.5|::.NETPortable0.0-Profile259|::.NETPortable0.0-Profile328|Microsoft.CSharp:4.3.0:.NETStandard1.0|NETStandard.Library:1.6.1:.NETStandard1.0|System.ComponentModel.TypeConverter:4.3.0:.NETStandard1.0|System.Runtime.Serialization.Primitives:4.3.0:.NETStandard1.0|Microsoft.CSharp:4.3.0:.NETStandard1.3|NETStandard.Library:1.6.1:.NETStandard1.3|System.ComponentModel.TypeConverter:4.3.0:.NETStandard1.3|System.Runtime.Serialization.Formatters:4.3.0:.NETStandard1.3|System.Runtime.Serialization.Primitives:4.3.0:.NETStandard1.3|System.Xml.XmlDocument:4.3.0:.NETStandard1.3|::.NETStandard2.0", + "Repository": "Inedo.ProGet.Feeds.NuGet.NuGetRepository", + "IsLocalPackage": true, + "LastUpdated": "\\/Date(1523621009833+0)\\/", + "Created": "\\/Date(1523621009833+0)\\/", + "Published": "\\/Date(1523621009833+0)\\/", + "PackageSize": "2400102", + "PackageHash": "IvJe1pj7JHEsP8B8J8DwlMEx8UInrs/x+9oVY+oCD13jpLu4JbJU2WCIsMRn5C4yW9+DgkaO8uiVE5VHKjpmdQ==", + "IsLatestVersion": false, + "IsAbsoluteLatestVersion": false, + "IsProGetHosted": true, + "IsPrerelease": false, + "IsCached": true, + "NormalizedVersion": "11.0.2", + "Listed": true, + "PackageHashAlgorithm": "SHA512", + "HasSymbols": false, + "HasSource": false, + "DownloadCount": 155, + "VersionDownloadCount": 155 + } + ], + "count": 0 + } +} diff --git a/test/_fixtures/nuget/latestV2.xml b/test/_fixtures/nuget/latestV2.xml new file mode 100644 index 0000000000000000000000000000000000000000..4195ee5b4f7cac841c16096839e55e3b7327536b --- /dev/null +++ b/test/_fixtures/nuget/latestV2.xml @@ -0,0 +1,54 @@ +<feed xml:base="https://www.nuget.org/api/v2" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"> + <id>http://schemas.datacontract.org/2004/07/</id> + <title/> + <updated>2019-02-04T11:39:35Z</updated> + <link rel="self" href="https://www.nuget.org/api/v2/Packages"/> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <title type="text">NUnit</title> + <summary type="text">NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.</summary> + <updated>2018-10-07T01:17:31Z</updated> + <author> + <name>Charlie Poole, Rob Prouse</name> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.11.0"/> + <m:properties> + <d:Id>NUnit</d:Id> + <d:Version>3.11.0</d:Version> + <d:NormalizedVersion>3.11.0</d:NormalizedVersion> + <d:Authors>Charlie Poole, Rob Prouse</d:Authors> + <d:Copyright>Copyright (c) 2018 Charlie Poole, Rob Prouse</d:Copyright> + <d:Created m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:Created> + <d:Dependencies>::net20|::net35|::net40|::net45|NETStandard.Library:[1.6.1, ):netstandard1.4|System.Reflection.TypeExtensions:[4.4.0, ):netstandard1.4|NETStandard.Library:[2.0.0, ):netstandard2.0</d:Dependencies> + <d:Description>NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible.This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.Supported platforms:- .NET Framework 2.0+- .NET Standard 1.4+- .NET Core</d:Description> + <d:DownloadCount m:type="Edm.Int32">34501529</d:DownloadCount> + <d:GalleryDetailsUrl>https://www.nuget.org/packages/NUnit/3.11.0</d:GalleryDetailsUrl> + <d:IconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</d:IconUrl> + <d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion> + <d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion> + <d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease> + <d:Language>en-US</d:Language> + <d:LastUpdated m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:LastUpdated> + <d:Published m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:Published> + <d:PackageHash>zecrYxUA5p5w8AZ2bvbBbiUIcrQnZAVPrziNMSWMdcOi0D2Oe7yKUNivWPIQMcUwQDHmWtS/ijnD48ubU/eHZQ==</d:PackageHash> + <d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm> + <d:PackageSize m:type="Edm.Int64">4124503</d:PackageSize> + <d:ProjectUrl>https://github.com/nunit/nunit</d:ProjectUrl> + <d:ReportAbuseUrl>https://www.nuget.org/packages/NUnit/3.11.0/ReportAbuse</d:ReportAbuseUrl> + <d:ReleaseNotes>This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.</d:ReleaseNotes> + <d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance> + <d:Summary>NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.</d:Summary> + <d:Tags>nunit test testing tdd framework fluent assert theory plugin addin</d:Tags> + <d:Title>NUnit</d:Title> + <d:VersionDownloadCount m:type="Edm.Int32">1282250</d:VersionDownloadCount> + <d:MinClientVersion>2.12</d:MinClientVersion> + <d:LastEdited m:type="Edm.DateTime">2018-10-07T01:21:48.043</d:LastEdited> + <d:LicenseUrl>https://raw.githubusercontent.com/nunit/nunit/master/LICENSE.txt</d:LicenseUrl> + <d:LicenseNames m:null="true"/> + <d:LicenseReportUrl m:null="true"/> + </m:properties> + </entry> +</feed> diff --git a/test/_fixtures/nuget/latestV2_withoutProjectUrl.xml b/test/_fixtures/nuget/latestV2_withoutProjectUrl.xml new file mode 100644 index 0000000000000000000000000000000000000000..bb8e407a4c34d99782dfefe160cd6ebeab6bc227 --- /dev/null +++ b/test/_fixtures/nuget/latestV2_withoutProjectUrl.xml @@ -0,0 +1,54 @@ +<feed xml:base="https://www.nuget.org/api/v2" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"> + <id>http://schemas.datacontract.org/2004/07/</id> + <title/> + <updated>2019-02-04T11:39:35Z</updated> + <link rel="self" href="https://www.nuget.org/api/v2/Packages"/> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <title type="text">NUnit</title> + <summary type="text">NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.</summary> + <updated>2018-10-07T01:17:31Z</updated> + <author> + <name>Charlie Poole, Rob Prouse</name> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.11.0"/> + <m:properties> + <d:Id>NUnit</d:Id> + <d:Version>3.11.0</d:Version> + <d:NormalizedVersion>3.11.0</d:NormalizedVersion> + <d:Authors>Charlie Poole, Rob Prouse</d:Authors> + <d:Copyright>Copyright (c) 2018 Charlie Poole, Rob Prouse</d:Copyright> + <d:Created m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:Created> + <d:Dependencies>::net20|::net35|::net40|::net45|NETStandard.Library:[1.6.1, ):netstandard1.4|System.Reflection.TypeExtensions:[4.4.0, ):netstandard1.4|NETStandard.Library:[2.0.0, ):netstandard2.0</d:Dependencies> + <d:Description>NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible.This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.Supported platforms:- .NET Framework 2.0+- .NET Standard 1.4+- .NET Core</d:Description> + <d:DownloadCount m:type="Edm.Int32">34501529</d:DownloadCount> + <d:GalleryDetailsUrl>https://www.nuget.org/packages/NUnit/3.11.0</d:GalleryDetailsUrl> + <d:IconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</d:IconUrl> + <d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion> + <d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion> + <d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease> + <d:Language>en-US</d:Language> + <d:LastUpdated m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:LastUpdated> + <d:Published m:type="Edm.DateTime">2018-10-07T01:17:31.31</d:Published> + <d:PackageHash>zecrYxUA5p5w8AZ2bvbBbiUIcrQnZAVPrziNMSWMdcOi0D2Oe7yKUNivWPIQMcUwQDHmWtS/ijnD48ubU/eHZQ==</d:PackageHash> + <d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm> + <d:PackageSize m:type="Edm.Int64">4124503</d:PackageSize> + <d:ProjectUrl/> + <d:ReportAbuseUrl>https://www.nuget.org/packages/NUnit/3.11.0/ReportAbuse</d:ReportAbuseUrl> + <d:ReleaseNotes>This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.</d:ReleaseNotes> + <d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance> + <d:Summary>NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.</d:Summary> + <d:Tags>nunit test testing tdd framework fluent assert theory plugin addin</d:Tags> + <d:Title>NUnit</d:Title> + <d:VersionDownloadCount m:type="Edm.Int32">1282250</d:VersionDownloadCount> + <d:MinClientVersion>2.12</d:MinClientVersion> + <d:LastEdited m:type="Edm.DateTime">2018-10-07T01:21:48.043</d:LastEdited> + <d:LicenseUrl>https://raw.githubusercontent.com/nunit/nunit/master/LICENSE.txt</d:LicenseUrl> + <d:LicenseNames m:null="true"/> + <d:LicenseReportUrl m:null="true"/> + </m:properties> + </entry> +</feed> diff --git a/test/_fixtures/nuget/nunit.json b/test/_fixtures/nuget/nunit.json deleted file mode 100644 index 8ca06ec6601e1efc6fcc8c13df03c6da35f8e0ad..0000000000000000000000000000000000000000 --- a/test/_fixtures/nuget/nunit.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "versions": [ - "2.5.7.10213", - "2.5.9.10348", - "2.5.10.11092", - "2.6.0.12051", - "2.6.0.12054", - "2.6.1", - "2.6.2", - "2.6.3", - "2.6.4", - "2.6.5", - "2.6.6", - "3.0.0-alpha", - "3.0.0-alpha-2", - "3.0.0-alpha-3", - "3.0.0-alpha-4", - "3.0.0-alpha-5", - "3.0.0-beta-1", - "3.0.0-beta-2", - "3.0.0-beta-3", - "3.0.0-beta-4", - "3.0.0-beta-5", - "3.0.0-rc", - "3.0.0-rc-2", - "3.0.0-rc-3", - "3.0.0", - "3.0.1", - "3.2.0", - "3.2.1", - "3.4.0", - "3.4.1", - "3.5.0", - "3.6.0", - "3.6.1", - "3.7.0", - "3.7.1", - "3.8.0", - "3.8.1", - "3.9.0", - "3.10.0", - "3.10.1" - ] -} \ No newline at end of file diff --git a/test/_fixtures/nuget/nunitV2.json b/test/_fixtures/nuget/nunitV2.json new file mode 100644 index 0000000000000000000000000000000000000000..9eb545f94f5fdbb0aed764402058000886c8f7f3 --- /dev/null +++ b/test/_fixtures/nuget/nunitV2.json @@ -0,0 +1,46 @@ +{ + "d": { + "results": [ + { "Version": "2.5.7.10213" }, + { "Version": "2.5.9.10348" }, + { "Version": "2.5.10.11092" }, + { "Version": "2.6.0.12051" }, + { "Version": "2.6.0.12054" }, + { "Version": "2.6.1" }, + { "Version": "2.6.2" }, + { "Version": "2.6.3" }, + { "Version": "2.6.4" }, + { "Version": "2.6.5" }, + { "Version": "2.6.6" }, + { "Version": "3.0.0-alpha" }, + { "Version": "3.0.0-alpha-2" }, + { "Version": "3.0.0-alpha-3" }, + { "Version": "3.0.0-alpha-4" }, + { "Version": "3.0.0-alpha-5" }, + { "Version": "3.0.0-beta-1" }, + { "Version": "3.0.0-beta-2" }, + { "Version": "3.0.0-beta-3" }, + { "Version": "3.0.0-beta-4" }, + { "Version": "3.0.0-beta-5" }, + { "Version": "3.0.0-rc" }, + { "Version": "3.0.0-rc-2" }, + { "Version": "3.0.0-rc-3" }, + { "Version": "3.0.0" }, + { "Version": "3.0.1" }, + { "Version": "3.2.0" }, + { "Version": "3.2.1" }, + { "Version": "3.4.0" }, + { "Version": "3.4.1" }, + { "Version": "3.5.0" }, + { "Version": "3.6.0" }, + { "Version": "3.6.1" }, + { "Version": "3.7.0" }, + { "Version": "3.7.1" }, + { "Version": "3.8.0" }, + { "Version": "3.8.1" }, + { "Version": "3.9.0" }, + { "Version": "3.10.0" }, + { "Version": "3.10.1" } + ] + } +} diff --git a/test/_fixtures/nuget/nunitV2.xml b/test/_fixtures/nuget/nunitV2.xml new file mode 100644 index 0000000000000000000000000000000000000000..9dc7307fedbf92192b4e18d6eb2c6920bf59aef0 --- /dev/null +++ b/test/_fixtures/nuget/nunitV2.xml @@ -0,0 +1,651 @@ +<feed xml:base="https://www.nuget.org/api/v2" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"> + <id>http://schemas.datacontract.org/2004/07/</id> + <title/> + <updated>2019-02-04T12:51:36Z</updated> + <link rel="self" href="https://www.nuget.org/api/v2/Packages"/> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.11.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.11.0"/> + <m:properties> + <d:Version>3.11.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.7.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.7.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.7.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.7.0"/> + <m:properties> + <d:Version>2.7.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.7')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.7')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.7')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.7"/> + <m:properties> + <d:Version>2.6.7</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.6')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.6')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.6')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.6"/> + <m:properties> + <d:Version>2.6.6</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.5')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.5')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.5')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.5"/> + <m:properties> + <d:Version>2.6.5</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.10.1"/> + <m:properties> + <d:Version>3.10.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.10.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.10.0"/> + <m:properties> + <d:Version>3.10.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.9.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.9.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.9.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.9.0"/> + <m:properties> + <d:Version>3.9.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.8.1"/> + <m:properties> + <d:Version>3.8.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.8.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.8.0"/> + <m:properties> + <d:Version>3.8.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.7.1"/> + <m:properties> + <d:Version>3.7.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.7.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.7.0"/> + <m:properties> + <d:Version>3.7.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.6.1"/> + <m:properties> + <d:Version>3.6.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.6.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.6.0"/> + <m:properties> + <d:Version>3.6.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.5.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.5.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.5.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.5.0"/> + <m:properties> + <d:Version>3.5.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.4.1"/> + <m:properties> + <d:Version>3.4.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.4.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.4.0"/> + <m:properties> + <d:Version>3.4.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.2.1"/> + <m:properties> + <d:Version>3.2.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.2.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.2.0"/> + <m:properties> + <d:Version>3.2.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.1"/> + <m:properties> + <d:Version>3.0.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0"/> + <m:properties> + <d:Version>3.0.0</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.4')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.4')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.4')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.4"/> + <m:properties> + <d:Version>2.6.4</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-3')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-3')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-3')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-rc-3"/> + <m:properties> + <d:Version>3.0.0-rc-3</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-2')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-2')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc-2')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-rc-2"/> + <m:properties> + <d:Version>3.0.0-rc-2</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-rc')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-rc"/> + <m:properties> + <d:Version>3.0.0-rc</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-5')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-5')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-5')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-beta-5"/> + <m:properties> + <d:Version>3.0.0-beta-5</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-4')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-4')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-4')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-beta-4"/> + <m:properties> + <d:Version>3.0.0-beta-4</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.3')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.3')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.3')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.3"/> + <m:properties> + <d:Version>2.6.3</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.2')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.2')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.2')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.2"/> + <m:properties> + <d:Version>2.6.2</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-alpha"/> + <m:properties> + <d:Version>3.0.0-alpha</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12054')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12054')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12054')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.0.12054"/> + <m:properties> + <d:Version>2.6.0.12054</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.1"/> + <m:properties> + <d:Version>2.6.1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-2')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-2')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-2')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-beta-2"/> + <m:properties> + <d:Version>3.0.0-beta-2</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-3')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-3')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-3')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-beta-3"/> + <m:properties> + <d:Version>3.0.0-beta-3</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.10.11092')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.10.11092')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.10.11092')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.5.10.11092"/> + <m:properties> + <d:Version>2.5.10.11092</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.7.10213')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.7.10213')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.7.10213')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.5.7.10213"/> + <m:properties> + <d:Version>2.5.7.10213</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12051')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12051')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.6.0.12051')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.6.0.12051"/> + <m:properties> + <d:Version>2.6.0.12051</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-3')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-3')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-3')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-alpha-3"/> + <m:properties> + <d:Version>3.0.0-alpha-3</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-1')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-1')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-beta-1')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-beta-1"/> + <m:properties> + <d:Version>3.0.0-beta-1</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-4')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-4')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-4')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-alpha-4"/> + <m:properties> + <d:Version>3.0.0-alpha-4</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.9.10348')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.9.10348')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='2.5.9.10348')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/2.5.9.10348"/> + <m:properties> + <d:Version>2.5.9.10348</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-2')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-2')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-2')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-alpha-2"/> + <m:properties> + <d:Version>3.0.0-alpha-2</d:Version> + </m:properties> + </entry> + <entry> + <id>https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-5')</id> + <category term="NuGetGallery.OData.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> + <link rel="edit" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-5')"/> + <link rel="self" href="https://www.nuget.org/api/v2/Packages(Id='NUnit',Version='3.0.0-alpha-5')"/> + <title type="text">NUnit</title> + <updated>2019-02-04T12:51:36Z</updated> + <author> + <name/> + </author> + <content type="application/zip" src="https://www.nuget.org/api/v2/package/NUnit/3.0.0-alpha-5"/> + <m:properties> + <d:Version>3.0.0-alpha-5</d:Version> + </m:properties> + </entry> +</feed> diff --git a/test/_fixtures/nuget/nunitV3.json b/test/_fixtures/nuget/nunitV3.json new file mode 100644 index 0000000000000000000000000000000000000000..0cfb1f9542d6b713402b3b40c095df468e2cfbaa --- /dev/null +++ b/test/_fixtures/nuget/nunitV3.json @@ -0,0 +1,188 @@ +{ + "@context": { + "@vocab": "http://schema.nuget.org/schema#", + "@base": "https://api.nuget.org/v3/registration3/" + }, + "totalHits": 1, + "lastReopen": "2019-02-04T10:47:54.6449537Z", + "index": "v3-lucene2-v2v3-20171018", + "data": [ + { + "@id": "https://api.nuget.org/v3/registration3/nunit/index.json", + "@type": "Package", + "registration": "https://api.nuget.org/v3/registration3/nunit/index.json", + "id": "NUnit", + "version": "3.11.0", + "description": "NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible.\n\nThis package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.\n\nSupported platforms:\n- .NET Framework 2.0+\n- .NET Standard 1.4+\n- .NET Core", + "summary": "NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.", + "title": "NUnit", + "iconUrl": "https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png", + "licenseUrl": "https://raw.githubusercontent.com/nunit/nunit/master/LICENSE.txt", + "projectUrl": "https://github.com/nunit/nunit", + "tags": [ + "nunit", + "test", + "testing", + "tdd", + "framework", + "fluent", + "assert", + "theory", + "plugin", + "addin" + ], + "authors": [ + "Charlie Poole, Rob Prouse" + ], + "totalDownloads": 34513003, + "verified": true, + "versions": [ + { + "version": "2.5.7.10213", + "downloads": 120456, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.7.10213.json" + }, + { + "version": "2.5.9.10348", + "downloads": 35430, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.9.10348.json" + }, + { + "version": "2.5.10.11092", + "downloads": 398490, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.10.11092.json" + }, + { + "version": "2.6.0.12054", + "downloads": 378279, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.0.12054.json" + }, + { + "version": "2.6.1", + "downloads": 247167, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.1.json" + }, + { + "version": "2.6.2", + "downloads": 1294687, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.2.json" + }, + { + "version": "2.6.3", + "downloads": 2830278, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.3.json" + }, + { + "version": "2.6.4", + "downloads": 5738258, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.4.json" + }, + { + "version": "2.6.5", + "downloads": 23173, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.5.json" + }, + { + "version": "2.6.6", + "downloads": 14324, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.6.json" + }, + { + "version": "2.6.7", + "downloads": 24558, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.7.json" + }, + { + "version": "2.7.0", + "downloads": 27939, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.7.0.json" + }, + { + "version": "3.0.0", + "downloads": 342037, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.0.0.json" + }, + { + "version": "3.0.1", + "downloads": 858272, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.0.1.json" + }, + { + "version": "3.2.0", + "downloads": 529977, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.2.0.json" + }, + { + "version": "3.2.1", + "downloads": 680526, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.2.1.json" + }, + { + "version": "3.4.0", + "downloads": 103314, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.4.0.json" + }, + { + "version": "3.4.1", + "downloads": 1237846, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.4.1.json" + }, + { + "version": "3.5.0", + "downloads": 1682294, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.5.0.json" + }, + { + "version": "3.6.0", + "downloads": 1089915, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.6.0.json" + }, + { + "version": "3.6.1", + "downloads": 1967691, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.6.1.json" + }, + { + "version": "3.7.0", + "downloads": 197893, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.7.0.json" + }, + { + "version": "3.7.1", + "downloads": 1747106, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.7.1.json" + }, + { + "version": "3.8.0", + "downloads": 87425, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.8.0.json" + }, + { + "version": "3.8.1", + "downloads": 4326904, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.8.1.json" + }, + { + "version": "3.9.0", + "downloads": 3224020, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.9.0.json" + }, + { + "version": "3.10.0", + "downloads": 39849, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.10.0.json" + }, + { + "version": "3.10.1", + "downloads": 3857714, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.10.1.json" + }, + { + "version": "3.11.0", + "downloads": 1284682, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.11.0.json" + } + ] + } + ] +} diff --git a/test/_fixtures/nuget/nunitV3_withoutProjectUrl.json b/test/_fixtures/nuget/nunitV3_withoutProjectUrl.json new file mode 100644 index 0000000000000000000000000000000000000000..411a70ed7a5a1d38256244c35279fa38890522be --- /dev/null +++ b/test/_fixtures/nuget/nunitV3_withoutProjectUrl.json @@ -0,0 +1,187 @@ +{ + "@context": { + "@vocab": "http://schema.nuget.org/schema#", + "@base": "https://api.nuget.org/v3/registration3/" + }, + "totalHits": 1, + "lastReopen": "2019-02-04T10:47:54.6449537Z", + "index": "v3-lucene2-v2v3-20171018", + "data": [ + { + "@id": "https://api.nuget.org/v3/registration3/nunit/index.json", + "@type": "Package", + "registration": "https://api.nuget.org/v3/registration3/nunit/index.json", + "id": "NUnit", + "version": "3.11.0", + "description": "NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible.\n\nThis package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly.\n\nSupported platforms:\n- .NET Framework 2.0+\n- .NET Standard 1.4+\n- .NET Core", + "summary": "NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.", + "title": "NUnit", + "iconUrl": "https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png", + "licenseUrl": "https://raw.githubusercontent.com/nunit/nunit/master/LICENSE.txt", + "tags": [ + "nunit", + "test", + "testing", + "tdd", + "framework", + "fluent", + "assert", + "theory", + "plugin", + "addin" + ], + "authors": [ + "Charlie Poole, Rob Prouse" + ], + "totalDownloads": 34513003, + "verified": true, + "versions": [ + { + "version": "2.5.7.10213", + "downloads": 120456, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.7.10213.json" + }, + { + "version": "2.5.9.10348", + "downloads": 35430, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.9.10348.json" + }, + { + "version": "2.5.10.11092", + "downloads": 398490, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.5.10.11092.json" + }, + { + "version": "2.6.0.12054", + "downloads": 378279, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.0.12054.json" + }, + { + "version": "2.6.1", + "downloads": 247167, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.1.json" + }, + { + "version": "2.6.2", + "downloads": 1294687, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.2.json" + }, + { + "version": "2.6.3", + "downloads": 2830278, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.3.json" + }, + { + "version": "2.6.4", + "downloads": 5738258, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.4.json" + }, + { + "version": "2.6.5", + "downloads": 23173, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.5.json" + }, + { + "version": "2.6.6", + "downloads": 14324, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.6.json" + }, + { + "version": "2.6.7", + "downloads": 24558, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.6.7.json" + }, + { + "version": "2.7.0", + "downloads": 27939, + "@id": "https://api.nuget.org/v3/registration3/nunit/2.7.0.json" + }, + { + "version": "3.0.0", + "downloads": 342037, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.0.0.json" + }, + { + "version": "3.0.1", + "downloads": 858272, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.0.1.json" + }, + { + "version": "3.2.0", + "downloads": 529977, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.2.0.json" + }, + { + "version": "3.2.1", + "downloads": 680526, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.2.1.json" + }, + { + "version": "3.4.0", + "downloads": 103314, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.4.0.json" + }, + { + "version": "3.4.1", + "downloads": 1237846, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.4.1.json" + }, + { + "version": "3.5.0", + "downloads": 1682294, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.5.0.json" + }, + { + "version": "3.6.0", + "downloads": 1089915, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.6.0.json" + }, + { + "version": "3.6.1", + "downloads": 1967691, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.6.1.json" + }, + { + "version": "3.7.0", + "downloads": 197893, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.7.0.json" + }, + { + "version": "3.7.1", + "downloads": 1747106, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.7.1.json" + }, + { + "version": "3.8.0", + "downloads": 87425, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.8.0.json" + }, + { + "version": "3.8.1", + "downloads": 4326904, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.8.1.json" + }, + { + "version": "3.9.0", + "downloads": 3224020, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.9.0.json" + }, + { + "version": "3.10.0", + "downloads": 39849, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.10.0.json" + }, + { + "version": "3.10.1", + "downloads": 3857714, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.10.1.json" + }, + { + "version": "3.11.0", + "downloads": 1284682, + "@id": "https://api.nuget.org/v3/registration3/nunit/3.11.0.json" + } + ] + } + ] +} diff --git a/test/_fixtures/nuget/nunitv3_nuget-org.xml b/test/_fixtures/nuget/nunitv3_nuget-org.xml new file mode 100644 index 0000000000000000000000000000000000000000..711a9c13de47ee288b376c1819f940d9b42d781d --- /dev/null +++ b/test/_fixtures/nuget/nunitv3_nuget-org.xml @@ -0,0 +1,37 @@ +<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> + <metadata minClientVersion="2.12"> + <id>NUnit</id> + <version>3.11.0</version> + <title>NUnit</title> + <authors>Charlie Poole, Rob Prouse</authors> + <owners>Charlie Poole, Rob Prouse</owners> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <licenseUrl>https://raw.githubusercontent.com/nunit/nunit/master/LICENSE.txt</licenseUrl> + <projectUrl>http://nunit.org/</projectUrl> + <iconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</iconUrl> + <description> + NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible. This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly. Supported platforms: - .NET Framework 2.0+ - .NET Standard 1.4+ - .NET Core + </description> + <summary>NUnit is a unit-testing framework for all .NET languages with a strong TDD focus.</summary> + <releaseNotes> + This package includes the NUnit 3 framework assembly, which is referenced by your tests. You will need to install version 3 of the nunit3-console program or a third-party runner that supports NUnit 3 in order to execute tests. Runners intended for use with NUnit 2.x will not run NUnit 3 tests correctly. + </releaseNotes> + <copyright>Copyright (c) 2018 Charlie Poole, Rob Prouse</copyright> + <language>en-US</language> + <tags>nunit test testing tdd framework fluent assert theory plugin addin</tags> + <repository type="git" url="https://github.com/nunit/nunit" /> + <dependencies> + <group targetFramework=".NETFramework2.0" /> + <group targetFramework=".NETFramework3.5" /> + <group targetFramework=".NETFramework4.0" /> + <group targetFramework=".NETFramework4.5" /> + <group targetFramework=".NETStandard1.4"> + <dependency id="NETStandard.Library" version="1.6.1" /> + <dependency id="System.Reflection.TypeExtensions" version="4.4.0" exclude="compile" /> + </group> + <group targetFramework=".NETStandard2.0"> + <dependency id="NETStandard.Library" version="2.0.0" /> + </group> + </dependencies> + </metadata> +</package> diff --git a/test/_fixtures/nuget/sample.nuspec b/test/_fixtures/nuget/sample.nuspec deleted file mode 100644 index 920db03eec74b8dc31d82009ce2c2ceb01007441..0000000000000000000000000000000000000000 --- a/test/_fixtures/nuget/sample.nuspec +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd"> - <metadata minClientVersion="2.12"> - <id>Newtonsoft.Json</id> - <version>11.0.2</version> - <title>Json.NET</title> - <authors>James Newton-King</authors> - <owners>James Newton-King</owners> - <requireLicenseAcceptance>false</requireLicenseAcceptance> - <licenseUrl>https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md</licenseUrl> - <projectUrl>https://www.newtonsoft.com/json</projectUrl> - <iconUrl>https://www.newtonsoft.com/content/images/nugeticon.png</iconUrl> - <description>Json.NET is a popular high-performance JSON framework for .NET</description> - <copyright>Copyright © James Newton-King 2008</copyright> - <tags>json</tags> - <repository type="git" url="https://github.com/JamesNK/Newtonsoft.Json.git" /> - <dependencies> - <group targetFramework=".NETFramework2.0" /> - <group targetFramework=".NETFramework3.5" /> - <group targetFramework=".NETFramework4.0" /> - <group targetFramework=".NETFramework4.5" /> - <group targetFramework=".NETPortable0.0-Profile259" /> - <group targetFramework=".NETPortable0.0-Profile328" /> - <group targetFramework=".NETStandard1.0"> - <dependency id="Microsoft.CSharp" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" /> - <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" /> - </group> - <group targetFramework=".NETStandard1.3"> - <dependency id="Microsoft.CSharp" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" /> - <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" /> - <dependency id="System.Xml.XmlDocument" version="4.3.0" exclude="Build,Analyzers" /> - </group> - <group targetFramework=".NETStandard2.0" /> - </dependencies> - </metadata> -</package> \ No newline at end of file diff --git a/test/datasource/__snapshots__/nuget.spec.js.snap b/test/datasource/__snapshots__/nuget.spec.js.snap index b66c69bf67fd8e39e8ab14519085313c093c8e49..83950cda1ace69d77d7d435ae013c73602c08669 100644 --- a/test/datasource/__snapshots__/nuget.spec.js.snap +++ b/test/datasource/__snapshots__/nuget.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/nuget getPkgReleases processes real data 1`] = ` +exports[`datasource/nuget getPkgReleases processes real data (v2) 1`] = ` Object { - "name": "nunit", + "pkgName": "nunit", "releases": Array [ Object { "version": "2.6.1", @@ -22,6 +22,12 @@ Object { Object { "version": "2.6.6", }, + Object { + "version": "2.6.7", + }, + Object { + "version": "2.7.0", + }, Object { "version": "3.0.0-alpha", }, @@ -109,7 +115,383 @@ Object { Object { "version": "3.10.1", }, + Object { + "version": "3.11.0", + }, + ], + "sourceUrl": "https://github.com/nunit/nunit", +} +`; + +exports[`datasource/nuget getPkgReleases processes real data (v3) feed is a nuget.org 1`] = ` +Object { + "pkgName": "nunit", + "releases": Array [ + Object { + "version": "2.6.1", + }, + Object { + "version": "2.6.2", + }, + Object { + "version": "2.6.3", + }, + Object { + "version": "2.6.4", + }, + Object { + "version": "2.6.5", + }, + Object { + "version": "2.6.6", + }, + Object { + "version": "2.6.7", + }, + Object { + "version": "2.7.0", + }, + Object { + "version": "3.0.0", + }, + Object { + "version": "3.0.1", + }, + Object { + "version": "3.2.0", + }, + Object { + "version": "3.2.1", + }, + Object { + "version": "3.4.0", + }, + Object { + "version": "3.4.1", + }, + Object { + "version": "3.5.0", + }, + Object { + "version": "3.6.0", + }, + Object { + "version": "3.6.1", + }, + Object { + "version": "3.7.0", + }, + Object { + "version": "3.7.1", + }, + Object { + "version": "3.8.0", + }, + Object { + "version": "3.8.1", + }, + Object { + "version": "3.9.0", + }, + Object { + "version": "3.10.0", + }, + Object { + "version": "3.10.1", + }, + Object { + "version": "3.11.0", + }, + ], + "sourceUrl": "https://github.com/nunit/nunit", +} +`; + +exports[`datasource/nuget getPkgReleases processes real data (v3) feed is not a nuget.org 1`] = ` +Object { + "pkgName": "nunit", + "releases": Array [ + Object { + "version": "2.6.1", + }, + Object { + "version": "2.6.2", + }, + Object { + "version": "2.6.3", + }, + Object { + "version": "2.6.4", + }, + Object { + "version": "2.6.5", + }, + Object { + "version": "2.6.6", + }, + Object { + "version": "2.6.7", + }, + Object { + "version": "2.7.0", + }, + Object { + "version": "3.0.0", + }, + Object { + "version": "3.0.1", + }, + Object { + "version": "3.2.0", + }, + Object { + "version": "3.2.1", + }, + Object { + "version": "3.4.0", + }, + Object { + "version": "3.4.1", + }, + Object { + "version": "3.5.0", + }, + Object { + "version": "3.6.0", + }, + Object { + "version": "3.6.1", + }, + Object { + "version": "3.7.0", + }, + Object { + "version": "3.7.1", + }, + Object { + "version": "3.8.0", + }, + Object { + "version": "3.8.1", + }, + Object { + "version": "3.9.0", + }, + Object { + "version": "3.10.0", + }, + Object { + "version": "3.10.1", + }, + Object { + "version": "3.11.0", + }, + ], + "sourceUrl": "https://github.com/nunit/nunit", +} +`; + +exports[`datasource/nuget getPkgReleases processes real data without project url (v2) 1`] = ` +Object { + "pkgName": "nunit", + "releases": Array [ + Object { + "version": "2.6.1", + }, + Object { + "version": "2.6.2", + }, + Object { + "version": "2.6.3", + }, + Object { + "version": "2.6.4", + }, + Object { + "version": "2.6.5", + }, + Object { + "version": "2.6.6", + }, + Object { + "version": "2.6.7", + }, + Object { + "version": "2.7.0", + }, + Object { + "version": "3.0.0-alpha", + }, + Object { + "version": "3.0.0-alpha-2", + }, + Object { + "version": "3.0.0-alpha-3", + }, + Object { + "version": "3.0.0-alpha-4", + }, + Object { + "version": "3.0.0-alpha-5", + }, + Object { + "version": "3.0.0-beta-1", + }, + Object { + "version": "3.0.0-beta-2", + }, + Object { + "version": "3.0.0-beta-3", + }, + Object { + "version": "3.0.0-beta-4", + }, + Object { + "version": "3.0.0-beta-5", + }, + Object { + "version": "3.0.0-rc", + }, + Object { + "version": "3.0.0-rc-2", + }, + Object { + "version": "3.0.0-rc-3", + }, + Object { + "version": "3.0.0", + }, + Object { + "version": "3.0.1", + }, + Object { + "version": "3.2.0", + }, + Object { + "version": "3.2.1", + }, + Object { + "version": "3.4.0", + }, + Object { + "version": "3.4.1", + }, + Object { + "version": "3.5.0", + }, + Object { + "version": "3.6.0", + }, + Object { + "version": "3.6.1", + }, + Object { + "version": "3.7.0", + }, + Object { + "version": "3.7.1", + }, + Object { + "version": "3.8.0", + }, + Object { + "version": "3.8.1", + }, + Object { + "version": "3.9.0", + }, + Object { + "version": "3.10.0", + }, + Object { + "version": "3.10.1", + }, + Object { + "version": "3.11.0", + }, + ], +} +`; + +exports[`datasource/nuget getPkgReleases processes real data without project url (v3) 1`] = ` +Object { + "pkgName": "nunit", + "releases": Array [ + Object { + "version": "2.6.1", + }, + Object { + "version": "2.6.2", + }, + Object { + "version": "2.6.3", + }, + Object { + "version": "2.6.4", + }, + Object { + "version": "2.6.5", + }, + Object { + "version": "2.6.6", + }, + Object { + "version": "2.6.7", + }, + Object { + "version": "2.7.0", + }, + Object { + "version": "3.0.0", + }, + Object { + "version": "3.0.1", + }, + Object { + "version": "3.2.0", + }, + Object { + "version": "3.2.1", + }, + Object { + "version": "3.4.0", + }, + Object { + "version": "3.4.1", + }, + Object { + "version": "3.5.0", + }, + Object { + "version": "3.6.0", + }, + Object { + "version": "3.6.1", + }, + Object { + "version": "3.7.0", + }, + Object { + "version": "3.7.1", + }, + Object { + "version": "3.8.0", + }, + Object { + "version": "3.8.1", + }, + Object { + "version": "3.9.0", + }, + Object { + "version": "3.10.0", + }, + Object { + "version": "3.10.1", + }, + Object { + "version": "3.11.0", + }, ], - "sourceUrl": "https://github.com/JamesNK/Newtonsoft.Json", } `; diff --git a/test/datasource/nuget.spec.js b/test/datasource/nuget.spec.js index ccdfaa3a6d701b24821a7129272314fc63b27ce0..d8ba31083bbb9f06acb120f5bfedfbc0d610da8f 100644 --- a/test/datasource/nuget.spec.js +++ b/test/datasource/nuget.spec.js @@ -4,61 +4,314 @@ const datasource = require('../../lib/datasource'); jest.mock('../../lib/util/got'); -const res1 = fs.readFileSync('test/_fixtures/nuget/nunit.json', 'utf8'); -const res2 = fs.readFileSync('test/_fixtures/nuget/sample.nuspec', 'utf8'); +const pkgListV3 = fs.readFileSync('test/_fixtures/nuget/nunitV3.json', 'utf8'); +const pkgListV3WithoutProkjectUrl = fs.readFileSync( + 'test/_fixtures/nuget/nunitV3_withoutProjectUrl.json', + 'utf8' +); +const pkgInfoV3FromNuget = fs.readFileSync( + 'test/_fixtures/nuget/nunitv3_nuget-org.xml', + 'utf8' +); + +const pkgListV2 = fs.readFileSync('test/_fixtures/nuget/nunitV2.xml', 'utf8'); + +const pkgLatestV2 = fs.readFileSync( + 'test/_fixtures/nuget/latestV2.xml', + 'utf8' +); +const pkgLatestV2WithoutProkjectUrl = fs.readFileSync( + 'test/_fixtures/nuget/latestV2_withoutProjectUrl.xml', + 'utf8' +); + +const nugetIndexV3 = fs.readFileSync( + 'test/_fixtures/nuget/indexV3.json', + 'utf8' +); + +const configV3V2 = { + datasource: 'nuget', + lookupName: 'nunit', + registryUrls: [ + 'https://api.nuget.org/v3/index.json', + 'https://www.nuget.org/api/v2/', + ], +}; + +const configV2 = { + datasource: 'nuget', + lookupName: 'nunit', + registryUrls: ['https://www.nuget.org/api/v2/'], +}; + +const configV3 = { + datasource: 'nuget', + lookupName: 'nunit', + registryUrls: ['https://api.nuget.org/v3/index.json'], +}; + +const configV3NotNugetOrg = { + datasource: 'nuget', + lookupName: 'nunit', + registryUrls: ['https://myprivatefeed/index.json'], +}; describe('datasource/nuget', () => { describe('getPkgReleases', () => { beforeEach(() => { global.repoCache = {}; }); - it('returns null for empty result', async () => { + + it(`can't detect nuget feed version`, async () => { + const config = { + datasource: 'nuget', + lookupName: 'nunit', + registryUrls: ['#$#api.nuget.org/v3/index.xml'], + }; + + expect( + await datasource.getPkgReleases({ + ...config, + }) + ).toBeNull(); + }); + + it(`can't get packages list (v3)`, async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); + got.mockReturnValueOnce({ + statusCode: 500, + }); + const res = await datasource.getPkgReleases({ + ...configV3, + }); + + expect(res).toBeNull(); + }); + it(`empty packages list (v3)`, async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: JSON.parse('{"totalHits": 0}'), + statusCode: 200, + }); + const res = await datasource.getPkgReleases({ + ...configV3, + }); + + expect(res).toBeNull(); + }); + it(`can't get package info (v2)`, async () => { + got.mockReturnValueOnce({ + body: pkgListV2, + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: pkgLatestV2, + statusCode: 500, + }); + expect( + await datasource.getPkgReleases({ + ...configV2, + }) + ).toBeNull(); + }); + + it('returns null for empty result (v3v2)', async () => { + got.mockReturnValueOnce({}); + expect( + await datasource.getPkgReleases({ + ...configV3V2, + }) + ).toBeNull(); + }); + it('returns null for empty result (v2)', async () => { + got.mockReturnValueOnce({}); + expect( + await datasource.getPkgReleases({ + ...configV2, + }) + ).toBeNull(); + }); + it('returns null for empty result (v3)', async () => { got.mockReturnValueOnce({}); expect( await datasource.getPkgReleases({ - datasource: 'nuget', - lookupName: 'something', + ...configV3, + }) + ).toBeNull(); + }); + + it('returns null for non 200 (v3v2)', async () => { + got.mockImplementationOnce(() => + Promise.reject({ + statusCode: 500, + }) + ); + expect( + await datasource.getPkgReleases({ + ...configV3V2, + }) + ).toBeNull(); + }); + it('returns null for non 200 (v3)', async () => { + got.mockImplementationOnce(() => + Promise.reject({ + statusCode: 500, + }) + ); + expect( + await datasource.getPkgReleases({ + ...configV3, }) ).toBeNull(); }); - it('returns null for 404', async () => { + it('returns null for non 200 (v3)', async () => { got.mockImplementationOnce(() => Promise.reject({ - statusCode: 404, + statusCode: 500, }) ); expect( await datasource.getPkgReleases({ - datasource: 'nuget', - lookupName: 'something', + ...configV2, + }) + ).toBeNull(); + }); + + it('returns null for unknown error (v3v2)', async () => { + got.mockImplementationOnce(() => { + throw new Error(); + }); + expect( + await datasource.getPkgReleases({ + ...configV3V2, + }) + ).toBeNull(); + }); + it('returns null for unknown error in getPkgReleasesFromV3Feed (v3)', async () => { + got.mockImplementationOnce(() => { + throw new Error(); + }); + expect( + await datasource.getPkgReleases({ + ...configV3, + }) + ).toBeNull(); + }); + it('returns null for unknown error in getQueryUrlForV3Feed (v3)', async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); + got.mockImplementationOnce(() => { + throw new Error(); + }); + expect( + await datasource.getPkgReleases({ + ...configV3, }) ).toBeNull(); }); - it('returns null for unknown error', async () => { + it('returns null for unknown error (v2)', async () => { got.mockImplementationOnce(() => { throw new Error(); }); expect( await datasource.getPkgReleases({ - datasource: 'nuget', - lookupName: 'something', + ...configV2, }) ).toBeNull(); }); - it('processes real data', async () => { + + it('processes real data (v3) feed is a nuget.org', async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); got.mockReturnValueOnce({ - body: JSON.parse(res1), + body: JSON.parse(pkgListV3), + statusCode: 200, }); got.mockReturnValueOnce({ - body: res2, + body: pkgInfoV3FromNuget, + statusCode: 200, }); const res = await datasource.getPkgReleases({ - datasource: 'nuget', - lookupName: 'nunit', + ...configV3, + }); + expect(res).not.toBeNull(); + expect(res).toMatchSnapshot(); + expect(res.sourceUrl).toBeDefined(); + }); + it('processes real data (v3) feed is not a nuget.org', async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: JSON.parse(pkgListV3), + statusCode: 200, + }); + const res = await datasource.getPkgReleases({ + ...configV3NotNugetOrg, + }); + expect(res).not.toBeNull(); + expect(res).toMatchSnapshot(); + expect(res.sourceUrl).toBeDefined(); + }); + it('processes real data without project url (v3)', async () => { + got.mockReturnValueOnce({ + body: JSON.parse(nugetIndexV3), + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: JSON.parse(pkgListV3WithoutProkjectUrl), + statusCode: 200, + }); + const res = await datasource.getPkgReleases({ + ...configV3NotNugetOrg, + }); + expect(res).not.toBeNull(); + expect(res).toMatchSnapshot(); + expect(res.sourceUrl).not.toBeDefined(); + }); + it('processes real data (v2)', async () => { + got.mockReturnValueOnce({ + body: pkgListV2, + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: pkgLatestV2, + statusCode: 200, + }); + const res = await datasource.getPkgReleases({ + ...configV2, }); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); expect(res.sourceUrl).toBeDefined(); }); + it('processes real data without project url (v2)', async () => { + got.mockReturnValueOnce({ + body: pkgListV2, + statusCode: 200, + }); + got.mockReturnValueOnce({ + body: pkgLatestV2WithoutProkjectUrl, + statusCode: 200, + }); + const res = await datasource.getPkgReleases({ + ...configV2, + }); + expect(res).not.toBeNull(); + expect(res).toMatchSnapshot(); + expect(res.sourceUrl).not.toBeDefined(); + }); }); }); diff --git a/website/docs/nuget.md b/website/docs/nuget.md index 8bf91e5b0993081499fefeafa2fdb4baf7fd24bc..7594ffa5ace3ba46eb8942d87c36d93a1cc56e94 100644 --- a/website/docs/nuget.md +++ b/website/docs/nuget.md @@ -24,6 +24,22 @@ To convert your .NET Framework .csproj into an SDK-style project, one can follow 3. Renovate will look up the latest version on [nuget.org](https://nuget.org) to determine if any upgrades are available 4. If the source package includes a GitHub URL as its source, and has either a "changelog" file or uses GitHub releases, then Release Notes for each version will be embedded in the generated PR. +## Alternate nuget feeds + +Renovate by default performs all lookups on `https://api.nuget.org/v3/index.json`, but it also supports alternative nuget feeds. Alternative feeds can be specified in configuration file: + +```json +"nuget": { + "registryUrls": [ + "https://api.nuget.org/v3/index.json", + "http://example1.com/nuget/" + "http://example2.com/nuget/v3/index.json" + ] +} +``` + +If this example we defined 3 nuget feeds. Packages resolving will process feeds consequentially. It means that if package will be resolved in second feed renovate won't look in last one. + ## Future work Contributions and/or feature requests are welcome to support more patterns or additional use cases.