12345678910111213141516 |
- def test_get_conn_uri(self, mock_secret_client, mock_azure_cred):
- mock_cred = mock.Mock()
- mock_sec_client = mock.Mock()
- mock_azure_cred.return_value = mock_cred
- mock_secret_client.return_value = mock_sec_client
- mock_sec_client.get_secret.return_value = mock.Mock(
- value='postgresql://airflow:airflow@host:5432/airflow'
- )
- backend = AzureKeyVaultBackend(vault_url="https://example-akv-resource-name.vault.azure.net/")
- returned_uri = backend.get_conn_uri(conn_id='hi')
- mock_secret_client.assert_called_once_with(
- credential=mock_cred, vault_url='https://example-akv-resource-name.vault.azure.net/'
- )
- assert returned_uri == 'postgresql://airflow:airflow@host:5432/airflow'
|