From 10ea5839f9ad985b96b01ebde032129e059ab63b Mon Sep 17 00:00:00 2001 From: Joppe Vos Date: Tue, 10 Oct 2023 11:44:29 +0200 Subject: [PATCH] Add test to check for correct mock values --- .../test_bq_service_account_keyfile_dict.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/profiles/bigquery/test_bq_service_account_keyfile_dict.py b/tests/profiles/bigquery/test_bq_service_account_keyfile_dict.py index 8a260ec2f..0647e6800 100644 --- a/tests/profiles/bigquery/test_bq_service_account_keyfile_dict.py +++ b/tests/profiles/bigquery/test_bq_service_account_keyfile_dict.py @@ -72,6 +72,22 @@ def test_profile(mock_bigquery_conn_with_dict: Connection): assert profile_mapping.profile == expected +def test_mock_profile(mock_bigquery_conn_with_dict: Connection): + """ + Tests profile mock for keyfile_json is None. Giving keyfile_json a value will crash dbt ls. + """ + profile_mapping = GoogleCloudServiceAccountDictProfileMapping(mock_bigquery_conn_with_dict, {}) + expected = { + "type": "bigquery", + "method": "service-account-json", + "project": "mock_value", + "dataset": "mock_value", + "threads": 1, + "keyfile_json": None, + } + assert profile_mapping.mock_profile == expected + + def test_profile_env_vars(mock_bigquery_conn_with_dict: Connection): """ Tests that the environment variables get set correctly.