V14: Add optional key to template create model (#15471)

* Implement Id for request model

* Make key optional

* Add test for use case

---------

Co-authored-by: Elitsa <elm@umbraco.dk>
This commit is contained in:
Nikolaj Geisle
2024-01-02 08:57:07 +01:00
committed by GitHub
parent f026010102
commit 674c48ab9a
5 changed files with 25 additions and 4 deletions

View File

@@ -276,4 +276,21 @@ public class TemplateServiceTests : UmbracoIntegrationTest
Assert.IsFalse(result.Success);
Assert.AreEqual(TemplateOperationStatus.InvalidAlias, result.Status);
}
[Test]
public async Task Can_Create_Template_With_Key()
{
var key = Guid.NewGuid();
var result = await TemplateService.CreateAsync("Template", "template", "test", Constants.Security.SuperUserKey, key);
Assert.IsTrue(result.Success);
var template = await TemplateService.GetAsync(key);
Assert.Multiple(() =>
{
Assert.IsNotNull(template);
Assert.AreEqual(key, template.Key);
});
}
}