* Only use datetimeoffset in API * Updated publish endpoint to take schedule information * Fixed test builds * OpenApi updates * Update OpenApi schema * Fixed issues with publishing. * Added validation before publishing. Had to move a lot of classes to core. * added missing files * Added validation info to error * Typo * Clean up and adding missing result * Updating to AvailableCultures instead of PublishedCultures * Handle time needs to be in the future * validate only cultures that needs to be published * Fix typos * Filter out cultures that we are not trying to publish from the validation errors * Don't filter out only the available cultures, to accommodate non-created variants * Only allow publish of existing cultures * Fixed issues found in test * fixed build --------- Co-authored-by: Elitsa <elm@umbraco.dk>
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using NUnit.Framework;
|
|
using Umbraco.Cms.Core;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.Models.ContentPublishing;
|
|
using Umbraco.Cms.Core.Services.OperationStatus;
|
|
using Umbraco.Cms.Tests.Common.Builders;
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services;
|
|
|
|
public partial class ContentPublishingServiceTests
|
|
{
|
|
[Test]
|
|
public async Task Can_Publish_Root_In_The_Future()
|
|
{
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
|
|
var result = await ContentPublishingService.PublishAsync(
|
|
Textpage.Key,
|
|
MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.Now.AddDays(1), null)),
|
|
Constants.Security.SuperUserKey);
|
|
|
|
Assert.IsTrue(result.Success);
|
|
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
}
|
|
|
|
[Test]
|
|
public async Task Publish_Single_Item_Does_Not_Publish_Children_In_The_Future()
|
|
{
|
|
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.Now.AddDays(1), null)), Constants.Security.SuperUserKey);
|
|
|
|
VerifyIsNotPublished(Textpage.Key);
|
|
VerifyIsNotPublished(Subpage.Key);
|
|
}
|
|
|
|
[Test]
|
|
public async Task Can_Publish_Child_Of_Root_In_The_Future()
|
|
{
|
|
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey);
|
|
|
|
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.Now.AddDays(1), null)), Constants.Security.SuperUserKey);
|
|
|
|
Assert.IsTrue(result.Success);
|
|
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
|
VerifyIsPublished(Textpage.Key);
|
|
VerifyIsNotPublished(Subpage.Key);
|
|
}
|
|
|
|
}
|