Skip to content

Commit

Permalink
Merge pull request #11251 from dependabot/dev/brettfo/nuget-packages-…
Browse files Browse the repository at this point in the history
…config-unauthorized

expand pattern to report unauthorized feed
  • Loading branch information
randhircs authored Jan 8, 2025
2 parents 081474e + 4bf6898 commit e45d543
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2347,16 +2347,18 @@ public async Task MissingVisualStudioComponentTargetsAreReportedAsMissingFiles()
Assert.Equal("$(MSBuildExtensionsPath32)/Microsoft/VisualStudio/v$(VisualStudioVersion)/Some.Visual.Studio.Component.props", result.ErrorDetails!.ToString().NormalizePathToUnix());
}

[Fact]
public async Task ReportsPrivateSourceAuthenticationFailure()
[Theory]
[InlineData(401)]
[InlineData(403)]
public async Task ReportsPrivateSourceAuthenticationFailure(int httpStatusCode)
{
static (int, string) TestHttpHandler(string uriString)
(int, string) TestHttpHandler(string uriString)
{
var uri = new Uri(uriString, UriKind.Absolute);
var baseUrl = $"{uri.Scheme}://{uri.Host}:{uri.Port}";
return uri.PathAndQuery switch
{
_ => (401, "{}"), // everything is unauthorized
_ => (httpStatusCode, "{}"), // everything is unauthorized
};
}
using var http = TestHttpServer.CreateTestStringServer(TestHttpHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ internal static void ThrowOnUnauthenticatedFeed(string stdout)
"The plugin credential provider could not acquire credentials",
"401 (Unauthorized)",
"error NU1301: Unable to load the service index for source",
"Response status code does not indicate success: 403",
};
if (unauthorizedMessageSnippets.Any(stdout.Contains))
{
Expand Down

0 comments on commit e45d543

Please sign in to comment.