Integration Tests: Avoid asserting on errors for permission tests#20643
Merged
AndyButland merged 2 commits intomainfrom Nov 11, 2025
Merged
Integration Tests: Avoid asserting on errors for permission tests#20643AndyButland merged 2 commits intomainfrom
AndyButland merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses flaky integration tests that were incorrectly asserting on error responses instead of success responses. The key change involves fixing the PropertyTypeUsageService implementation that was causing actual errors, and updating test assertions to expect HttpStatusCode.OK instead of InternalServerError where appropriate.
Key changes:
- Fixed
PropertyTypeUsageRepositoryto useWhereIninstead ofContainsfor database queries, resolving the underlying bug - Added new integration tests for
PropertyTypeUsageServiceto verify the fix - Updated multiple controller permission tests to assert on
HttpStatusCode.OKinstead of error responses
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PropertyTypeUsageServiceTests.cs | New integration tests verifying the service correctly handles property value checks and content type validation |
| UmbracoIntegrationTestWithContent.cs | Extracted content type key constant for reuse in tests |
| PropertyTypeUsageRepository.cs | Fixed database query to use WhereIn instead of Contains, added XML documentation, and improved code formatting |
| PropertyTypeUsageService.cs | Removed unused _contentTypeService field and marked parameter for future removal, added XML documentation |
| IPropertyTypeUsageService.cs | Added XML documentation for interface |
| IPropertyTypeUsageRepository.cs | Added XML documentation for repository interface methods |
| InviteUserControllerTests.cs | Added clarifying comment explaining why InternalServerError is expected |
| IsUsedPropertyTypeControllerTests.cs | Changed assertion from InternalServerError to OK after underlying bug fix |
| ValidateLogFileSizeLogViewerControllerTests.cs | Changed assertion from InternalServerError to OK |
| LogLevelCountLogViewerControllerTests.cs | Changed assertion from InternalServerError to OK |
| AllMessageTemplateLogViewerControllerTests.cs | Changed assertion from InternalServerError to OK |
| AllLogViewerControllerTests.cs | Changed assertion from InternalServerError to OK |
| ExecuteActionHealthCheckControllerTests.cs | Changed assertion from InternalServerError to OK and added required Alias property to request |
…ert in management API permissions test.
…ions where we were asserting on an error response.
0c838b9 to
c3cead9
Compare
Zeegaan
approved these changes
Nov 11, 2025
Member
Zeegaan
left a comment
There was a problem hiding this comment.
Looks good to me, it has been a while since this was opened, so probably better switch the main branch to main 😁
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Resolves: #20639
Description
This PR fixes where we can - and comments where we can't - controller permission integration tests that were asserting on an error response.
There is an actual error revealed by one of these and noted in the linked issue, which is fixed and specific integration tests around this component -
PropertyTypeUsageService- have been added.Testing
Verify integration tests pass.