2024-02-21 08:10:48 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
using Umbraco.Cms.Core;
|
|
|
|
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
|
|
using Umbraco.Cms.Core.Services.OperationStatus;
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
2025-04-14 14:50:02 +02:00
|
|
|
|
MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)),
|
2024-02-21 08:10:48 +00:00
|
|
|
|
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()
|
|
|
|
|
|
{
|
2025-04-14 14:50:02 +02:00
|
|
|
|
await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey);
|
2024-02-21 08:10:48 +00:00
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
2025-04-14 14:50:02 +02:00
|
|
|
|
var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey);
|
2024-02-21 08:10:48 +00:00
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(result.Success);
|
|
|
|
|
|
Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status);
|
|
|
|
|
|
VerifyIsPublished(Textpage.Key);
|
|
|
|
|
|
VerifyIsNotPublished(Subpage.Key);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|