From ceda51617b58d8b188573b33fa1f896d31e012f4 Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Tue, 20 Feb 2024 16:18:30 +0000 Subject: [PATCH] fix: CSRF exempt unit_tests (#27168) --- .github/workflows/superset-python-unittest.yml | 4 ++++ tests/unit_tests/security/api_test.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/superset-python-unittest.yml b/.github/workflows/superset-python-unittest.yml index 548f128eac..d958ee0da4 100644 --- a/.github/workflows/superset-python-unittest.yml +++ b/.github/workflows/superset-python-unittest.yml @@ -7,10 +7,14 @@ on: - 'master' paths: - "superset/**" + - "requirements/**" + - "tests/unit_tests/**" pull_request: types: [synchronize, opened, reopened, ready_for_review] paths: - "superset/**" + - "requirements/**" + - "tests/unit_tests/**" # cancel previous workflow jobs for PRs concurrency: 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", + }