Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 813018a

Browse files
committed
Use Path with mocks
1 parent 259323e commit 813018a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/test_dbt.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_get_datadiff_variables_empty(self):
5454
def test_get_models(self, mock_manifest_parser, mock_run_parser, mock_open):
5555
expected_value = "expected_value"
5656
mock_self = Mock()
57-
mock_self.project_dir = ""
57+
mock_self.project_dir = Path()
5858
mock_run_results = Mock()
5959
mock_success_result = Mock()
6060
mock_failed_result = Mock()
@@ -82,7 +82,7 @@ def test_get_models(self, mock_manifest_parser, mock_run_parser, mock_open):
8282
@patch("data_diff.dbt.parse_manifest")
8383
def test_get_models_bad_lower_dbt_version(self, mock_manifest_parser, mock_run_parser, mock_open):
8484
mock_self = Mock()
85-
mock_self.project_dir = ""
85+
mock_self.project_dir = Path()
8686
mock_run_results = Mock()
8787
mock_run_parser.return_value = mock_run_results
8888
mock_run_results.metadata.dbt_version = "0.19.0"
@@ -100,7 +100,7 @@ def test_get_models_bad_lower_dbt_version(self, mock_manifest_parser, mock_run_p
100100
@patch("data_diff.dbt.parse_manifest")
101101
def test_get_models_bad_upper_dbt_version(self, mock_manifest_parser, mock_run_parser, mock_open):
102102
mock_self = Mock()
103-
mock_self.project_dir = ""
103+
mock_self.project_dir = Path()
104104
mock_run_results = Mock()
105105
mock_run_parser.return_value = mock_run_results
106106
mock_run_results.metadata.dbt_version = "1.5.1"
@@ -118,7 +118,7 @@ def test_get_models_bad_upper_dbt_version(self, mock_manifest_parser, mock_run_p
118118
@patch("data_diff.dbt.parse_manifest")
119119
def test_get_models_no_success(self, mock_manifest_parser, mock_run_parser, mock_open):
120120
mock_self = Mock()
121-
mock_self.project_dir = ""
121+
mock_self.project_dir = Path()
122122
mock_run_results = Mock()
123123
mock_success_result = Mock()
124124
mock_failed_result = Mock()
@@ -145,7 +145,7 @@ def test_get_models_no_success(self, mock_manifest_parser, mock_run_parser, mock
145145
def test_set_project_dict(self, mock_open, mock_yaml_parse):
146146
expected_dict = {"key1": "value1"}
147147
mock_self = Mock()
148-
mock_self.project_dir = ""
148+
mock_self.project_dir = Path()
149149
mock_yaml_parse.return_value = expected_dict
150150
DbtParser.set_project_dict(mock_self)
151151

@@ -170,7 +170,7 @@ def test_set_connection_snowflake(self, mock_open_file, mock_yaml_parse):
170170
}
171171

172172
mock_self = Mock()
173-
mock_self.profiles_dir = ""
173+
mock_self.profiles_dir = Path()
174174
mock_self.project_dict = {"profile": "profile_name"}
175175
mock_yaml_parse.return_value = profiles_dict
176176
DbtParser.set_connection(mock_self)
@@ -194,7 +194,7 @@ def test_set_connection_snowflake_no_password(self, mock_open_file, mock_yaml_pa
194194
}
195195

196196
mock_self = Mock()
197-
mock_self.profiles_dir = ""
197+
mock_self.profiles_dir = Path()
198198
mock_self.project_dict = {"profile": "profile_name"}
199199
mock_yaml_parse.return_value = profiles_dict
200200

@@ -227,7 +227,7 @@ def test_set_connection_bigquery(self, mock_open_file, mock_yaml_parse):
227227
}
228228

229229
mock_self = Mock()
230-
mock_self.profiles_dir = ""
230+
mock_self.profiles_dir = Path()
231231
mock_self.project_dict = {"profile": "profile_name"}
232232
mock_yaml_parse.return_value = profiles_dict
233233
DbtParser.set_connection(mock_self)
@@ -261,7 +261,7 @@ def test_set_connection_bigquery_not_oauth(self, mock_open_file, mock_yaml_parse
261261
}
262262

263263
mock_self = Mock()
264-
mock_self.profiles_dir = ""
264+
mock_self.profiles_dir = Path()
265265
mock_self.project_dict = {"profile": "profile_name"}
266266
mock_yaml_parse.return_value = profiles_dict
267267
with self.assertRaises(Exception):
@@ -287,8 +287,8 @@ def test_set_connection_key_error(self, mock_open_file, mock_yaml_parse):
287287
}
288288

289289
mock_self = Mock()
290-
mock_self.profiles_dir = ""
291-
mock_self.project_dir = ""
290+
mock_self.profiles_dir = Path()
291+
mock_self.project_dir = Path()
292292
mock_self.project_dict = {"profile": "bad_key"}
293293
mock_yaml_parse.return_value = profiles_dict
294294
with self.assertRaises(Exception):
@@ -314,8 +314,8 @@ def test_set_connection_not_implemented(self, mock_open_file, mock_yaml_parse):
314314
}
315315

316316
mock_self = Mock()
317-
mock_self.profiles_dir = ""
318-
mock_self.project_dir = ""
317+
mock_self.profiles_dir = Path()
318+
mock_self.project_dir = Path()
319319
mock_self.project_dict = {"profile": "profile_name"}
320320
mock_yaml_parse.return_value = profiles_dict
321321
with self.assertRaises(NotImplementedError):

0 commit comments

Comments
 (0)