Skip to content

Commit

Permalink
fix 1 test (#3371)
Browse files Browse the repository at this point in the history
  • Loading branch information
heng-liu committed May 20, 2020
1 parent ae6e179 commit 0f7c5f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,7 @@ public async Task GetTrustResultAsync_WithTimestampChainingToUntrustedRoot_NotAl
result.IsValid.Should().BeFalse();
resultsWithErrors.Count().Should().Be(1);
totalErrorIssues.Count().Should().Be(1);
totalErrorIssues.First().Code.Should().Be(NuGetLogCode.NU3028);
totalErrorIssues.First().Message.Should().Contain("A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider");
SigningTestUtility.AssertUntrustedRoot(totalErrorIssues, NuGetLogCode.NU3028, LogLevel.Error);
}
}

Expand Down
9 changes: 7 additions & 2 deletions test/TestUtilities/Test.Utility/Signing/SigningTestUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ public static void AssertRevocationStatusUnknown(IEnumerable<ILogMessage> issues
issue.Message.Contains(revocationStatusUnknown));
}

public static void AssertUntrustedRoot(IEnumerable<ILogMessage> issues, LogLevel logLevel)
public static void AssertUntrustedRoot(IEnumerable<ILogMessage> issues, NuGetLogCode code, LogLevel logLevel)
{
string untrustedRoot;

Expand All @@ -749,11 +749,16 @@ public static void AssertUntrustedRoot(IEnumerable<ILogMessage> issues, LogLevel
}

Assert.Contains(issues, issue =>
issue.Code == NuGetLogCode.NU3018 &&
issue.Code == code &&
issue.Level == logLevel &&
issue.Message.Contains(untrustedRoot));
}

public static void AssertUntrustedRoot(IEnumerable<ILogMessage> issues, LogLevel logLevel)
{
AssertUntrustedRoot(issues, NuGetLogCode.NU3018, logLevel);
}

public static void AssertNotTimeValid(IEnumerable<ILogMessage> issues, LogLevel logLevel)
{
string notTimeValid;
Expand Down

0 comments on commit 0f7c5f2

Please sign in to comment.