Skip to content

Commit

Permalink
Fix mocking the right method in secret backend test (#22524)
Browse files Browse the repository at this point in the history
The #22348 introduced a change on how connections are retrieved
from secret backends, but one of the tests has not been
changed to follow.

This fixes failing main.
  • Loading branch information
potiuk authored Mar 25, 2022
1 parent ee1d143 commit 388f4e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/secrets/test_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def test_backends_kwargs(self):
)
@mock.patch(
"airflow.providers.amazon.aws.secrets.systems_manager."
"SystemsManagerParameterStoreBackend.get_conn_uri"
"SystemsManagerParameterStoreBackend.get_connection"
)
def test_backend_fallback_to_env_var(self, mock_get_uri):
mock_get_uri.return_value = None
def test_backend_fallback_to_env_var(self, mock_get_connection):
mock_get_connection.return_value = None

backends = ensure_secrets_loaded()
backend_classes = [backend.__class__.__name__ for backend in backends]
Expand All @@ -106,7 +106,7 @@ def test_backend_fallback_to_env_var(self, mock_get_uri):
conn = Connection.get_connection_from_secrets(conn_id="test_mysql")

# Assert that SystemsManagerParameterStoreBackend.get_conn_uri was called
mock_get_uri.assert_called_once_with(conn_id='test_mysql')
mock_get_connection.assert_called_once_with(conn_id='test_mysql')

assert 'mysql://airflow:airflow@host:5432/airflow' == conn.get_uri()

Expand Down

0 comments on commit 388f4e8

Please sign in to comment.