Integration Tests: Avoid asserting on errors for permission tests (#20643)

* Added integration tests for PropertyTypeUsageService and adjusted assert in management API permissions test.

* Commented or fixed management API integration tests verifying permissions where we were asserting on an error response.
This commit is contained in:
Andy Butland
2025-11-11 06:59:25 +01:00
committed by GitHub
parent d8198d2f5c
commit cfa32b265a
13 changed files with 73 additions and 35 deletions

View File

@@ -1,7 +1,17 @@
namespace Umbraco.Cms.Core.Persistence.Repositories;
/// <summary>
/// Defines repository methods for querying property type usage.
/// </summary>
public interface IPropertyTypeUsageRepository
{
/// <summary>
/// Determines whether there are any saved property values for the specified content type and property alias.
/// </summary>
Task<bool> HasSavedPropertyValuesAsync(Guid contentTypeKey, string propertyAlias);
/// <summary>
/// Determines whether a content type with the specified unique identifier exists.
/// </summary>
Task<bool> ContentTypeExistAsync(Guid contentTypeKey);
}

View File

@@ -2,6 +2,9 @@ using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Core.Services;
/// <summary>
/// Defines service methods for querying property type usage.
/// </summary>
public interface IPropertyTypeUsageService
{
/// <summary>

View File

@@ -4,19 +4,25 @@ using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Core.Services;
/// <inheritdoc/>
public class PropertyTypeUsageService : IPropertyTypeUsageService
{
private readonly IPropertyTypeUsageRepository _propertyTypeUsageRepository;
private readonly IContentTypeService _contentTypeService;
private readonly ICoreScopeProvider _scopeProvider;
// TODO (V18): Remove IContentTypeService parameter from constructor.
/// <summary>
/// Initializes a new instance of the <see cref="PropertyTypeUsageService"/> class.
/// </summary>
public PropertyTypeUsageService(
IPropertyTypeUsageRepository propertyTypeUsageRepository,
#pragma warning disable IDE0060 // Remove unused parameter
IContentTypeService contentTypeService,
#pragma warning restore IDE0060 // Remove unused parameter
ICoreScopeProvider scopeProvider)
{
_propertyTypeUsageRepository = propertyTypeUsageRepository;
_contentTypeService = contentTypeService;
_scopeProvider = scopeProvider;
}