Expose and manage system media types (#16343)

* Expose and manage system media types

* Removed license :D
This commit is contained in:
Kenn Jacobsen
2024-05-24 08:59:47 +02:00
committed by GitHub
parent 8383532fd5
commit 07711aac28
11 changed files with 111 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Services;
@@ -113,4 +114,22 @@ public partial class MediaTypeEditingServiceTests
Assert.AreEqual(2, mediaType.NoGroupPropertyTypes.Count());
}
[TestCase(Constants.Conventions.MediaTypes.File)]
[TestCase(Constants.Conventions.MediaTypes.Folder)]
[TestCase(Constants.Conventions.MediaTypes.Image)]
public async Task Cannot_Change_Alias_Of_System_Media_Type(string mediaTypeAlias)
{
var mediaType = MediaTypeService.Get(mediaTypeAlias);
Assert.IsNotNull(mediaType);
var updateModel = MediaTypeUpdateModel(mediaTypeAlias, $"{mediaTypeAlias}_updated");
var result = await MediaTypeEditingService.UpdateAsync(mediaType, updateModel, Constants.Security.SuperUserKey);
Assert.Multiple(() =>
{
Assert.IsFalse(result.Success);
Assert.AreEqual(ContentTypeOperationStatus.NotAllowed, result.Status);
});
}
}