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 1382aa6f3939f123d3e33b075202117ec90a3034 Author: Daniel Vaz Gaspar <[email protected]> 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", + }
