Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mocking the right method in secret backend test #22524

Merged
merged 1 commit into from
Mar 25, 2022
Merged
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
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