Skip to content

Commit

Permalink
nuget: RepositoryFinder might not find PackageBaseAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
thepwagner committed Jun 23, 2021
1 parent 99a6a5f commit 3ebeb11
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,29 @@
)
end

context "that does not return PackageBaseAddress" do
let(:custom_repo_url) { "http://localhost:8082/artifactory/api/nuget/v3/nuget-local" }
before do
stub_request(:get, custom_repo_url).
to_return(
status: 200,
body: fixture("nuget_responses", "artifactory_base.json")
)
end

it "gets the right URL" do
expect(dependency_urls).to eq(
[{
repository_url: custom_repo_url,
search_url: "http://localhost:8082/artifactory/api/nuget/v3/"\
"nuget-local/query?q=microsoft.extensions.dependencymodel&prerelease=true",
auth_header: { "Authorization" => "Basic bXk6cGFzc3cwcmQ=" },
repository_type: "v3"
}]
)
end
end

context "that 404s" do
before { stub_request(:get, custom_repo_url).to_return(status: 404) }

Expand Down
74 changes: 74 additions & 0 deletions nuget/spec/fixtures/nuget_responses/artifactory_base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"version": "3.0.0",
"resources": [
{
"@id": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/query",
"@type": "SearchQueryService",
"comment": "Query endpoint of NuGet Search service (primary)"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/",
"@type": "RegistrationsBaseUrl",
"comment": "Base URL of Azure storage where NuGet package registration info is stored"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/nuget-local",
"@type": "LegacyGallery"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/nuget-local",
"@type": "LegacyGallery/2.0.0"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/nuget-local",
"@type": "PackagePublish/2.0.0"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/query",
"@type": "SearchQueryService/3.0.0-rc",
"comment": "Query endpoint of NuGet Search service (primary) used by RC clients"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/",
"@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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/{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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/{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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/query",
"@type": "SearchQueryService/3.0.0-beta",
"comment": "Query endpoint of NuGet Search service (primary) used by beta clients"
},
{
"@id": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/",
"@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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration/",
"@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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration-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": "http://localhost:8082/artifactory/api/nuget/v3/nuget-local/registration-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."
}
]
}

0 comments on commit 3ebeb11

Please sign in to comment.