Repository: apache/airflow
File: providers/keycloak/tests/unit/keycloak/auth_manager/test_keycloak_auth_manager.py (Python)

Code before:
        headers = auth_manager._get_headers(user.access_token)
        auth_manager.http_session.post.assert_called_once_with(
            token_url, data=payload, headers=headers, timeout=5
        )
        assert result == expected

    @pytest.mark.parametrize(
        ("function", "method", "details", "permission"),
        [
            ("is_authorized_dag", "GET", DagDetails(id="test", team_name="team-a"), "Dag#GET"),
            (
                "is_authorized_connection",
                "DELETE",
                ConnectionDetails(conn_id="test", team_name="team-a"),
                "Connection#DELETE",
            ),
            (
                "is_authorized_variable",
                "PUT",
                VariableDetails(key="test", team_name="team-a"),
                "Variable#PUT",
            ),
            ("is_authorized_pool", "POST", PoolDetails(name="test", team_name="team-a"), "Pool#POST"),
        ]
        if AIRFLOW_V_3_2_PLUS
        else [],
    )
    def test_team_name_ignored_when_multi_team_disabled(
        self, auth_manager, user, function, method, details, permission
    ):
        mock_response = Mock()
        mock_response.status_code = 200
        auth_manager.http_session.post = Mock(return_value=mock_response)

        getattr(auth_manager, function)(method=method, user=user, details=details)

        actual_permission = auth_manager.http_session.post.call_args.kwargs["data"]["permission"]
        assert actual_permission == permission

    @pytest.mark.parametrize(
        ("function", "details", "permission"),
        [
            ("is_authorized_dag", DagDetails(id="test", team_name="team-a"), "Dag:team-a#GET"),
            (
                "is_authorized_connection",
                ConnectionDetails(conn_id="test", team_name="team-a"),
                "Connection:team-a#GET",
            ),
            (
                "is_authorized_variable",
                VariableDetails(key="test", team_name="team-a"),

Review comment (suggestion):
Instead, you can skip this test if not `AIRFLOW_V_3_2_PLUS`

Code after:
        assert result == expected

    @pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, reason="team_name not supported before Airflow 3.2.0")
    @pytest.mark.parametrize(
        ("function", "method", "details_cls", "details_kwargs", "permission"),
        [
            ("is_authorized_dag", "GET", DagDetails, {"id": "test", "team_name": "team-a"}, "Dag#GET"),
            (
                "is_authorized_connection",
                "DELETE",
                ConnectionDetails,
                {"conn_id": "test", "team_name": "team-a"},
                "Connection#DELETE",
            ),
            (
                "is_authorized_variable",
                "PUT",
                VariableDetails,
                {"key": "test", "team_name": "team-a"},
                "Variable#PUT",
            ),
            ("is_authorized_pool", "POST", PoolDetails, {"name": "test", "team_name": "team-a"}, "Pool#POST"),
        ],
    )
    def test_team_name_ignored_when_multi_team_disabled(
        self, auth_manager, user, function, method, details_cls, details_kwargs, permission
    ):
        details = details_cls(**details_kwargs)
        mock_response = Mock()
        mock_response.status_code = 200
        auth_manager.http_session.post = Mock(return_value=mock_response)

        getattr(auth_manager, function)(method=method, user=user, details=details)

        actual_permission = auth_manager.http_session.post.call_args.kwargs["data"]["permission"]
        assert actual_permission == permission

    @pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, reason="team_name not supported before Airflow 3.2.0")
    @pytest.mark.parametrize(
        ("function", "details_cls", "details_kwargs", "permission"),
        [
            ("is_authorized_dag", DagDetails, {"id": "test", "team_name": "team-a"}, "Dag:team-a#GET"),
            (
                "is_authorized_connection",
                ConnectionDetails,
                {"conn_id": "test", "team_name": "team-a"},
                "Connection:team-a#GET",
            ),
            (
                "is_authorized_variable",
                VariableDetails,