Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ repos:
^airflow-ctl.*\.py$|
^airflow-core/src/airflow/models/.*\.py$|
^airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py$|
^airflow-core/tests/unit/cli/commands/test_rotate_fernet_key_command\.py$|
^task_sdk.*\.py$
pass_filenames: true
- id: update-supported-versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import pytest
from cryptography.fernet import Fernet
from sqlalchemy import select

from airflow.cli import cli_parser
from airflow.cli.commands import rotate_fernet_key_command
Expand Down Expand Up @@ -71,7 +72,7 @@ def test_should_rotate_variable(self, session):
# Assert correctness using a new fernet key
with conf_vars({("core", "fernet_key"): fernet_key2.decode()}):
get_fernet.cache_clear() # Clear cached fernet
var1 = session.query(Variable).filter(Variable.key == var1_key).first()
var1 = session.execute(select(Variable).where(Variable.key == var1_key)).scalar_one_or_none()
# Unencrypted variable should be unchanged
assert Variable.get(key=var1_key) == "value"
assert var1._val == "value"
Expand Down Expand Up @@ -103,7 +104,9 @@ def test_should_rotate_connection(self, session, mock_supervisor_comms):
rotate_fernet_key_command.rotate_fernet_key(args)

def mock_get_connection(conn_id):
conn = session.query(Connection).filter(Connection.conn_id == conn_id).first()
conn = session.execute(
select(Connection).where(Connection.conn_id == conn_id)
).scalar_one_or_none()
if conn:
from airflow.sdk.execution_time.comms import ConnectionResult

Expand Down