-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issues with publishing in cache and reintroduced tests (#17168)
* Fixed issues with publishing in cache and reintroduced tests * Fixed issue with republishing and templates
- Loading branch information
Showing
3 changed files
with
539 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 42 additions & 43 deletions
85
....Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheTemplateTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,42 @@ | ||
// using NUnit.Framework; | ||
// using Umbraco.Cms.Core; | ||
// using Umbraco.Cms.Core.Models.ContentEditing; | ||
// using Umbraco.Cms.Core.PublishedCache; | ||
// using Umbraco.Cms.Core.Services; | ||
// using Umbraco.Cms.Core.Services.OperationStatus; | ||
// using Umbraco.Cms.Tests.Common.Testing; | ||
// using Umbraco.Cms.Tests.Integration.Testing; | ||
// FIXME | ||
// namespace Umbraco.Cms.Tests.Integration.Umbraco.PublishedCache.HybridCache; | ||
// | ||
// [TestFixture] | ||
// [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] | ||
// public class DocumentHybridCacheTemplateTests : UmbracoIntegrationTestWithContentEditing | ||
// { | ||
// protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddUmbracoHybridCache(); | ||
// | ||
// private IPublishedContentCache PublishedContentHybridCache => GetRequiredService<IPublishedContentCache>(); | ||
// | ||
// private IContentEditingService ContentEditingService => GetRequiredService<IContentEditingService>(); | ||
// | ||
// [Test] | ||
// public async Task Can_Get_Document_After_Removing_Template() | ||
// { | ||
// // Arrange | ||
// var textPageBefore = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); | ||
// Assert.AreEqual(textPageBefore.TemplateId, TemplateId); | ||
// var updateModel = new ContentUpdateModel(); | ||
// { | ||
// updateModel.TemplateKey = null; | ||
// updateModel.InvariantName = textPageBefore.Name; | ||
// } | ||
// | ||
// // Act | ||
// var updateContentResult = await ContentEditingService.UpdateAsync(textPageBefore.Key, updateModel, Constants.Security.SuperUserKey); | ||
// | ||
// // Assert | ||
// Assert.AreEqual(updateContentResult.Status, ContentEditingOperationStatus.Success); | ||
// var textPageAfter = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); | ||
// // Should this not be null? | ||
// Assert.AreEqual(textPageAfter.TemplateId, null); | ||
// } | ||
// } | ||
using NUnit.Framework; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.Models.ContentEditing; | ||
using Umbraco.Cms.Core.PublishedCache; | ||
using Umbraco.Cms.Core.Services; | ||
using Umbraco.Cms.Core.Services.OperationStatus; | ||
using Umbraco.Cms.Tests.Common.Testing; | ||
using Umbraco.Cms.Tests.Integration.Testing; | ||
namespace Umbraco.Cms.Tests.Integration.Umbraco.PublishedCache.HybridCache; | ||
|
||
[TestFixture] | ||
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] | ||
public class DocumentHybridCacheTemplateTests : UmbracoIntegrationTestWithContentEditing | ||
{ | ||
protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddUmbracoHybridCache(); | ||
|
||
private IPublishedContentCache PublishedContentHybridCache => GetRequiredService<IPublishedContentCache>(); | ||
|
||
private IContentEditingService ContentEditingService => GetRequiredService<IContentEditingService>(); | ||
|
||
[Test] | ||
public async Task Can_Get_Document_After_Removing_Template() | ||
{ | ||
// Arrange | ||
var textPageBefore = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); | ||
Assert.AreEqual(textPageBefore.TemplateId, TemplateId); | ||
var updateModel = new ContentUpdateModel(); | ||
{ | ||
updateModel.TemplateKey = null; | ||
updateModel.InvariantName = textPageBefore.Name; | ||
} | ||
|
||
// Act | ||
var updateContentResult = await ContentEditingService.UpdateAsync(textPageBefore.Key, updateModel, Constants.Security.SuperUserKey); | ||
|
||
// Assert | ||
Assert.AreEqual(updateContentResult.Status, ContentEditingOperationStatus.Success); | ||
var textPageAfter = await PublishedContentHybridCache.GetByIdAsync(TextpageId, true); | ||
// Should this not be null? | ||
Assert.AreEqual(textPageAfter.TemplateId, null); | ||
} | ||
} |
Oops, something went wrong.