test: Add regression test for externalAuth PUT round-trip [DHIS2-17597]#24336
Open
karolinelien wants to merge 2 commits into
Open
test: Add regression test for externalAuth PUT round-trip [DHIS2-17597]#24336karolinelien wants to merge 2 commits into
karolinelien wants to merge 2 commits into
Conversation
Adds a controller test asserting that a user's externalAuth flag survives repeated full GET/PUT round-trips. The reported bug (2.39-2.41) toggled externalAuth on each PUT; this guards against a regression on the UserController.putJsonObject -> MetadataImport -> merge path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a controller regression test for DHIS2-17597 ("externalAuth changed to false when it should not be").
The original report (confirmed on 2.39.6 / 2.40.4 / 2.41.0) was that a full
PUT /api/users/{uid}keepingexternalAuthunchanged would toggle it (true→false→true) on each request.I re-tested the exact scenario against current master (via
play.im.dhis2.org/dev): create a user withexternalAuth=true(+openId), then GET the full payload and PUT it back repeatedly while changing another field.externalAuthis preserved correctly — no toggle. The bug appears to have been resolved incidentally by later User-model / metadata-merge refactors; there is no commit tied to the ticket.This PR adds a test that locks in the correct behavior so it cannot regress.
What the test does
UserControllerTest#testPutJsonObjectPreservesExternalAuth:externalAuth=trueon the user.externalAuthis stilltrue.true— the second PUT is what would have exposed the reported toggle.Notes / verification
AI Assisted