Skip to content

Commit

Permalink
Update TestCaseUITestContextExtensions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinE committed May 12, 2024
1 parent d0c0790 commit 62b4e1c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Lombiq.Tests.UI.Services;
using OpenQA.Selenium;
using OrchardCore.Media;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
Expand All @@ -13,6 +14,10 @@ namespace Lombiq.Hosting.MediaTheme.Tests.UI.Extensions;

public static class TestCaseUITestContextExtensions
{
[SuppressMessage(
"Security",
"CA5400:HttpClient may be created without enabling CheckCertificateRevocationList",
Justification = "It's only disabled for local testing.")]
public static async Task TestMediaThemeTemplatePageAsync(this UITestContext context, string tenantPrefix = null)
{
await context.ExecuteMediaThemeSampleRecipeDirectlyAsync();
Expand All @@ -22,7 +27,10 @@ public static async Task TestMediaThemeTemplatePageAsync(this UITestContext cont
// Instead of going to the page directly (which will fail) we'll check the response status code.
var templatesPageUri = context.GetAbsoluteUri(
$"{mediaOptions.Value.AssetsRequestPath}/{Paths.MediaThemeTemplatesWebPath}/Example.liquid");
using var client = new HttpClient();
using var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
using var client = new HttpClient(handler);

var response = await client.GetAsync(templatesPageUri);

Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
Expand Down

0 comments on commit 62b4e1c

Please sign in to comment.