codeant-ai-for-open-source[bot] commented on code in PR #40994:
URL: https://github.com/apache/superset/pull/40994#discussion_r3433881724


##########
tests/integration_tests/cli_tests.py:
##########
@@ -364,3 +365,115 @@ def 
test_re_encrypt_secrets_failure_exits_nonzero(app_context):
     # The failure path must be handled by the CLI, not leaked as an
     # uncaught exception.
     assert response.exception is None or isinstance(response.exception, 
SystemExit)
+
+
[email protected]("superset.cli.importexport.security_manager")
[email protected]("superset.examples.utils.load_configs_from_directory")
+def test_import_directory(
+    load_configs_mock: mock.MagicMock,
+    security_manager_mock: mock.MagicMock,
+    app_context: Any,
+    fs: Any,
+) -> None:
+    """
+    Test that import-directory calls load_configs_from_directory with the
+    correct arguments and assigns assets to the specified user.
+    """
+    # pylint: disable=reimported, redefined-outer-name
+    import superset.cli.importexport  # noqa: F811
+
+    importlib.reload(superset.cli.importexport)
+
+    fake_user = mock.MagicMock()
+    fake_user.username = "admin"
+    security_manager_mock.find_user.return_value = fake_user
+
+    captured_user: list[Any] = []
+
+    def capture_g_user(**kwargs: Any) -> None:
+        captured_user.append(g.user)

Review Comment:
   **Suggestion:** Add an inline docstring to the newly introduced helper 
function so it complies with the rule requiring documentation for new 
functions. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The helper `capture_g_user` is a newly introduced Python function in the 
changed code and it does not include a docstring. This matches the custom rule 
requiring new functions and classes to be documented inline.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b4ed5de7c31c4a6a8d29ad398d5d28ee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b4ed5de7c31c4a6a8d29ad398d5d28ee&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/integration_tests/cli_tests.py
   **Line:** 393:394
   **Comment:**
        *Custom Rule: Add an inline docstring to the newly introduced helper 
function so it complies with the rule requiring documentation for new functions.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=7f119f0c28c7e57c4bd602dcf360e20f8b4ffa134471aa91252153ff5938ecc5&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40994&comment_hash=7f119f0c28c7e57c4bd602dcf360e20f8b4ffa134471aa91252153ff5938ecc5&reaction=dislike'>👎</a>



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