Add test for sibling endpoint returning parent id even when its a folder (#20118)
* Improve GetManagementApiUrl to use the globally defined default version if not specified on the controller * Add a test to check logic introduced in #20083 * Update tests/Umbraco.Tests.Integration/ManagementApi/Trees/DocumentTypeSiblingControllerTests.cs Co-authored-by: Andy Butland <abutland73@gmail.com> * Update tests/Umbraco.Tests.Integration/ManagementApi/Trees/DocumentTypeSiblingControllerTests.cs Co-authored-by: Andy Butland <abutland73@gmail.com> --------- Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ using Microsoft.AspNetCore.TestHost;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Api.Delivery.Controllers.Content;
|
||||
@@ -132,7 +133,9 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest
|
||||
}
|
||||
|
||||
|
||||
methodParams["version"] = method?.GetCustomAttribute<MapToApiVersionAttribute>()?.Versions?.First().MajorVersion.ToString();
|
||||
methodParams["version"] =
|
||||
method?.GetCustomAttribute<MapToApiVersionAttribute>()?.Versions?.First().MajorVersion.ToString() // get it from the attribute
|
||||
?? Factory.Services.GetRequiredService<IOptions<ApiVersioningOptions>>()?.Value.DefaultApiVersion.MajorVersion.ToString(); // or use the default version from options
|
||||
if (method == null)
|
||||
{
|
||||
throw new MissingMethodException(
|
||||
|
||||
Reference in New Issue
Block a user