Skip to content

Commit caeb35f

Browse files
authored
Merge pull request #447 from Lombiq/issue/OFFI-200
OFFI-200: Add client configuration to CreateAndAuthorizeClientAsync
2 parents 5c2b55c + 734fd85 commit caeb35f

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

Lombiq.Tests.UI/CompatibilitySuppressions.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
2+
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
33
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
44
<Suppression>
55
<DiagnosticId>CP0001</DiagnosticId>
@@ -15,6 +15,13 @@
1515
<Right>lib/net8.0/Lombiq.Tests.UI.dll</Right>
1616
<IsBaselineSuppression>true</IsBaselineSuppression>
1717
</Suppression>
18+
<Suppression>
19+
<DiagnosticId>CP0002</DiagnosticId>
20+
<Target>M:Lombiq.Tests.UI.Extensions.HttpClientUITestContextExtensions.CreateAndAuthorizeClientAsync(Lombiq.Tests.UI.Services.UITestContext,System.String,System.String,System.String,System.String,System.String)</Target>
21+
<Left>lib/net8.0/Lombiq.Tests.UI.dll</Left>
22+
<Right>lib/net8.0/Lombiq.Tests.UI.dll</Right>
23+
<IsBaselineSuppression>true</IsBaselineSuppression>
24+
</Suppression>
1825
<Suppression>
1926
<DiagnosticId>CP0002</DiagnosticId>
2027
<Target>M:Lombiq.Tests.UI.Services.WebDriverFactory.CreateInternetExplorerDriverAsync(Lombiq.Tests.UI.Services.BrowserConfiguration,System.TimeSpan)</Target>

Lombiq.Tests.UI/Extensions/HttpClientUITestContextExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public static async Task<HttpClient> CreateAndAuthorizeClientAsync(
4747
string clientId = "UITest",
4848
string clientSecret = "Password",
4949
string userName = null,
50-
string password = null)
50+
string password = null,
51+
Action<HttpClient> configureClient = null)
5152
{
5253
var parameters = new List<KeyValuePair<string, string>>
5354
{
@@ -65,6 +66,8 @@ public static async Task<HttpClient> CreateAndAuthorizeClientAsync(
6566
using var requestBody = new FormUrlEncodedContent(parameters);
6667

6768
var client = context.CreateClient();
69+
configureClient?.Invoke(client);
70+
6871
var tokenUrl = new Uri(context.Scope.BaseUri, "connect/token");
6972
using var tokenResponse = await client.PostAsync(tokenUrl, requestBody);
7073

Lombiq.Tests.UI/SecurityScanning/OrchardCoreUITestExecutorConfigurationExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public static Func<IWebApplicationInstance, Task> CreateAppLogAssertionForSecuri
5858
// Thrown from Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync() when ZAP sends
5959
// invalid authentication challenges.
6060
"System.InvalidOperationException: No authentication handler is registered for the scheme",
61+
// If the middleware is enabled, logs like this are emitted next to every exception even if they are
62+
// already suppressed by one of these patterns.
63+
"Lombiq.Tests.UI.Shortcuts.Middlewares.ExceptionContextLoggingMiddleware: HTTP request when the exception",
6164
};
6265

6366
permittedErrorLinePatterns.AddRange(additionalPermittedErrorLinePatterns);

0 commit comments

Comments
 (0)