Skip to content

Integration Tests: Adjusting Status Codes for Failing Tests - #23125

Merged
AndyButland merged 1 commit into
mainfrom
v18/qa/redirect-delete-by-key-notfound-auth-test
Jun 15, 2026
Merged

Integration Tests: Adjusting Status Codes for Failing Tests#23125
AndyButland merged 1 commit into
mainfrom
v18/qa/redirect-delete-by-key-notfound-auth-test

Conversation

@NillasKA

@NillasKA NillasKA commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

This one kind of annoyed me when running tests on a different branch, and seeing these fail i had to fix them.

So this issue baffled me, because it seems the changes that caused this was introduced in my own PR #22985, that added RedirectUrlOperationStatus to the deletion of redirects. This apparently messed up some of the tests. On my PR all tests passed, so that confused me a good amount, i still do not understand why or how, but regardless i see why they are failing now.

So the issue here seems to stem from the fact that the DeleteByKeyRedirectUrlManagementControllerTests was used as part of the auth test suite to test permissions etc. The MethodSelector in these tests used to call a method that would just be void so not return anything and therefore status code OK was fine to test against, the caller had permission to call the method, no need to worry.

Now with the RedirectUrlOperationStatus these tests return NotFound, so the caller still has permission to call it, but the tests expect OK rather than NotFound. This PR adjusts the expected outcome of the method called.

@claude

claude Bot commented Jun 15, 2026

Copy link
Copy Markdown

Claude finished @NillasKA's task in 1m 36s —— View job


PR Review

  • Gather context and understand the PR
  • Read changed file
  • Review the changes
  • Post findings and verdict

PR Review

Target: origin/main · Based on commit: 07a8f93d · Classified as: Test-only

Corrects three expected HTTP status codes in the redirect URL deletion auth tests from OK (200) to NotFound (404), reflecting the actual response now that the controller maps RedirectUrlOperationStatus.NotFound when the target key doesn't exist.


No critical, important, or suggestion-level findings.

The fix is correct and well-reasoned. Auth tests deliberately call the endpoint with a random Guid.NewGuid() that will never exist in the database — so authorized users (Admin, Editor, Writer) correctly receive 404 NotFound rather than 200 OK, while unauthorized roles still receive 403 Forbidden or 401 Unauthorized as before. The RedirectUrlManagementControllerBase confirms NotFound → 404 in its status map.


Approved

This looks good to be merged as-is. Thanks for tracking down the root cause and for the clear explanation in the PR description!

@sonarqubecloud

Copy link
Copy Markdown

@AndyButland AndyButland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NillasKA - looks good. I wondered whether we should do some data setup so we could continue to get an OK response, but then I considered that NotFound carries out the authorisation check just as well (and that's what these controller tests are about).

@AndyButland
AndyButland merged commit 9fe9469 into main Jun 15, 2026
33 checks passed
@AndyButland
AndyButland deleted the v18/qa/redirect-delete-by-key-notfound-auth-test branch June 15, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants