AndreMeyerr opened a new pull request, #40878:
URL: https://github.com/apache/superset/pull/40878

   ## Summary
   Adds dedicated unit tests for `get_current_user` in 
`superset/tasks/utils.py`.
   This function had no prior unit test coverage in the repository.
   
   ## Motivation
   `get_current_user` is used to resolve the executor of scheduled async tasks
   (e.g. thumbnail generation via `get_executor`). Despite its role in task
   execution, it had no dedicated unit tests — only integration-level references
   where it was mocked as a dependency of other tests.
   
   ## Changes
   - Added `tests/unit_tests/tasks/get_current_user.py` with 7 test cases
   - Techniques: equivalence partitioning (black-box) + branch/MC/DC (white-box)
   - Isolation: module loaded via `importlib` + `patch.object` on `g` to avoid
     requiring a full Superset application context
   
   ## Test cases
   | ID | Condition | Expected |
   |---|---|---|
   | CT01 | `g.user` attribute absent | `None` |
   | CT02 | `g.user = None` (falsy) | `None` |
   | CT03 | anonymous user (`is_anonymous=True`) | `None` |
   | CT04 | authenticated user | `username` |
   | CT05 | `g.user = 0` (non-None falsy) | `None` |
   | CT06 | `username = ""` (boundary) | `""` |
   | CT07 | `username = None` (boundary) | `None` |
   
   ## Execution


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to