bito-code-review[bot] commented on code in PR #42930:
URL: https://github.com/apache/superset/pull/42930#discussion_r3780787711


##########
tests/unit_tests/daos/test_tasks.py:
##########
@@ -395,16 +396,24 @@ def 
test_remove_subscriber_not_subscribed(session_with_task: Session) -> None:
     assert result is None
 
 
-def test_get_status(session_with_task: Session) -> None:
+def test_get_status(session_with_task: Session, mocker: MockerFixture) -> None:
     """Test get_status returns status string when task found by UUID"""
     from superset.daos.tasks import TaskDAO
+    from superset.models.task_subscribers import TaskSubscriber
+
+    # get_status enforces the TaskFilter, so the polling user must be
+    # authenticated and subscribed to see the task.
+    mocker.patch("superset.tasks.filters.get_user_id", 
return_value=TEST_USER_ID)
+    mocker.patch("superset.security_manager.is_admin", return_value=False)

Review Comment:
   <!-- Bito Reply -->
   The reviewer's suggestion to patch 
`superset.tasks.filters.security_manager.is_admin` is incorrect because 
`security_manager` is not a module-level import in `superset/tasks/filters.py`. 
Patching `superset.security_manager.is_admin` is the correct approach, as 
confirmed by the test results.
   
   **tests/unit_tests/daos/test_tasks.py**
   ```
   # get_status enforces the TaskFilter, so the polling user must be
       # authenticated and subscribed to see the task.
       mocker.patch("superset.tasks.filters.get_user_id", 
return_value=TEST_USER_ID)
       mocker.patch("superset.security_manager.is_admin", return_value=False)
   ```



-- 
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