Skip to content

Commit

Permalink
expand pattern to report unauthorized feed
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Jan 8, 2025
1 parent 081474e commit 4bf6898
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 4bf6898

Please sign in to comment.