Fixed tess

This commit is contained in:
Bjarke Berg
2023-02-21 11:28:21 +01:00
parent be8f120851
commit ed25342311
4 changed files with 24 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Api.Management;
using Umbraco.Cms.Api.Management.Controllers.Install;
using Umbraco.Cms.Core.Persistence.Repositories;
using Umbraco.Cms.Persistence.Sqlite;
using Umbraco.Cms.Persistence.SqlServer;
using Umbraco.Cms.Tests.Common.Testing;
@@ -77,10 +78,12 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
// Executes after the standard ConfigureServices method
builder.ConfigureTestServices(services =>
{
// Add a test auth scheme with a test auth handler to authn and assign the user
services.AddAuthentication(TestAuthHandler.TestAuthenticationScheme)
.AddScheme<AuthenticationSchemeOptions, TestAuthHandler>(TestAuthHandler.TestAuthenticationScheme, options => { }));
.AddScheme<AuthenticationSchemeOptions, TestAuthHandler>(
TestAuthHandler.TestAuthenticationScheme, options => { });
});
});
Client = Factory.CreateClient(new WebApplicationFactoryClientOptions

View File

@@ -0,0 +1,12 @@
using Umbraco.Cms.Core.Persistence.Repositories;
namespace Umbraco.Cms.Tests.Integration.Testing;
public class TestWebProfilerRepository : IWebProfilerRepository
{
private bool _status = false;
public void SetStatus(int userId, bool status) => _status = status;
public bool GetStatus(int userId) => _status;
}

View File

@@ -8,6 +8,7 @@ using NUnit.Framework;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Persistence.Repositories;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Core.Web;
@@ -19,6 +20,7 @@ using Umbraco.Cms.Persistence.SqlServer;
using Umbraco.Cms.Tests.Common.Builders;
using Umbraco.Cms.Tests.Integration.DependencyInjection;
using Umbraco.Cms.Tests.Integration.Extensions;
using Umbraco.Cms.Tests.Integration.TestServerTest;
using Constants = Umbraco.Cms.Core.Constants;
namespace Umbraco.Cms.Tests.Integration.Testing;
@@ -129,7 +131,9 @@ public abstract class UmbracoIntegrationTest : UmbracoIntegrationTestBase
// We register this service because we need it for IRuntimeState, if we don't this breaks 900 tests
services.AddSingleton<IConflictingRouteService, TestConflictingRouteService>();
services.AddSingleton<IWebProfilerRepository, TestWebProfilerRepository>();
services.AddLogger(webHostEnvironment, Configuration);
// Add it!

View File

@@ -7,6 +7,7 @@ using Moq;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Tests.Common;
using Umbraco.Cms.Web.Common.AspNetCore;
@@ -68,7 +69,8 @@ public class TestUmbracoContextFactory
hostingEnvironment,
new UriUtility(hostingEnvironment),
new AspNetCoreCookieManager(httpContextAccessor),
httpContextAccessor);
httpContextAccessor,
Mock.Of<IWebProfilerService>());
return umbracoContextFactory;
}