You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2024/02/22 21:09:57 UTC

(superset) 02/04: fix: CSRF exempt unit_tests (#27168)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1abe0054dcc673abe7c5912c74f806bc76d8663d
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Tue Feb 20 16:18:30 2024 +0000

    fix: CSRF exempt unit_tests (#27168)
---
 .github/workflows/superset-python-unittest.yml | 14 +++++++++++---
 tests/unit_tests/security/api_test.py          |  6 +++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/superset-python-unittest.yml b/.github/workflows/superset-python-unittest.yml
index 5f7639e67c..6eb9dcae95 100644
--- a/.github/workflows/superset-python-unittest.yml
+++ b/.github/workflows/superset-python-unittest.yml
@@ -5,8 +5,16 @@ on:
   push:
     branches-ignore:
       - "dependabot/npm_and_yarn/**"
+    paths:
+      - "superset/**"
+      - "requirements/**"
+      - "tests/unit_tests/**"
   pull_request:
     types: [synchronize, opened, reopened, ready_for_review]
+    paths:
+      - "superset/**"
+      - "requirements/**"
+      - "tests/unit_tests/**"
 
 jobs:
   unit-tests:
@@ -34,9 +42,9 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
-          cache: 'pip'
-          cache-dependency-path: 'requirements/testing.txt'
-# TODO: separated requirements.txt file just for unit tests
+          cache: "pip"
+          cache-dependency-path: "requirements/testing.txt"
+      # TODO: separated requirements.txt file just for unit tests
       - name: Install dependencies
         if: steps.check.outcome == 'failure'
         uses: ./.github/actions/cached-dependencies
diff --git a/tests/unit_tests/security/api_test.py b/tests/unit_tests/security/api_test.py
index 5d596073e9..73227166c2 100644
--- a/tests/unit_tests/security/api_test.py
+++ b/tests/unit_tests/security/api_test.py
@@ -28,4 +28,8 @@ def test_csrf_not_exempt(app_context: None) -> None:
     """
     Test that REST API is not exempt from CSRF.
     """
-    assert csrf._exempt_blueprints == {"MenuApi", "SecurityApi", "OpenApi"}
+    assert {blueprint.name for blueprint in csrf._exempt_blueprints} == {
+        "MenuApi",
+        "SecurityApi",
+        "OpenApi",
+    }