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

Commit 490886c

Browse files
committed
update assertions to expect Path
1 parent c1f4c3e commit 490886c

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
@@ -74,8 +74,8 @@ def test_get_models(self, mock_manifest_parser, mock_run_parser, mock_open):
7474
models = DbtParser.get_models(mock_self)
7575

7676
self.assertEqual(expected_value, models[0])
77-
mock_open.assert_any_call(RUN_RESULTS_PATH)
78-
mock_open.assert_any_call(MANIFEST_PATH)
77+
mock_open.assert_any_call(Path(RUN_RESULTS_PATH))
78+
mock_open.assert_any_call(Path(MANIFEST_PATH))
7979
mock_run_parser.assert_called_once_with(run_results={})
8080
mock_manifest_parser.assert_called_once_with(manifest={})
8181

@@ -92,7 +92,7 @@ def test_get_models_bad_lower_dbt_version(self, mock_manifest_parser, mock_run_p
9292
with self.assertRaises(Exception) as ex:
9393
DbtParser.get_models(mock_self)
9494

95-
mock_open.assert_called_once_with(RUN_RESULTS_PATH)
95+
mock_open.assert_called_once_with(Path(RUN_RESULTS_PATH))
9696
mock_run_parser.assert_called_once_with(run_results={})
9797
mock_manifest_parser.assert_not_called()
9898
self.assertIn("version to be", ex.exception.args[0])
@@ -110,7 +110,7 @@ def test_get_models_bad_upper_dbt_version(self, mock_manifest_parser, mock_run_p
110110
with self.assertRaises(Exception) as ex:
111111
DbtParser.get_models(mock_self)
112112

113-
mock_open.assert_called_once_with(RUN_RESULTS_PATH)
113+
mock_open.assert_called_once_with(Path(RUN_RESULTS_PATH))
114114
mock_run_parser.assert_called_once_with(run_results={})
115115
mock_manifest_parser.assert_not_called()
116116
self.assertIn("version to be", ex.exception.args[0])
@@ -137,8 +137,8 @@ def test_get_models_no_success(self, mock_manifest_parser, mock_run_parser, mock
137137
with self.assertRaises(Exception):
138138
DbtParser.get_models(mock_self)
139139

140-
mock_open.assert_any_call(RUN_RESULTS_PATH)
141-
mock_open.assert_any_call(MANIFEST_PATH)
140+
mock_open.assert_any_call(Path(RUN_RESULTS_PATH))
141+
mock_open.assert_any_call(Path(MANIFEST_PATH))
142142
mock_run_parser.assert_called_once_with(run_results={})
143143
mock_manifest_parser.assert_called_once_with(manifest={})
144144

@@ -152,7 +152,7 @@ def test_set_project_dict(self, mock_open, mock_yaml_parse):
152152
DbtParser.set_project_dict(mock_self)
153153

154154
self.assertEqual(mock_self.project_dict, expected_dict)
155-
mock_open.assert_called_once_with(PROJECT_FILE)
155+
mock_open.assert_called_once_with(Path(PROJECT_FILE))
156156

157157
@patch("data_diff.dbt.yaml.safe_load")
158158
@patch("builtins.open", new_callable=mock_open, read_data="key:\n value")
@@ -181,7 +181,7 @@ def test_set_connection_snowflake(self, mock_open_file, mock_yaml_parse):
181181
self.assertEqual(mock_self.connection.get("driver"), expected_driver)
182182
self.assertEqual(mock_self.connection.get("password"), expected_password)
183183
self.assertEqual(mock_self.requires_upper, True)
184-
mock_open_file.assert_called_once_with(PROFILES_FILE)
184+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
185185
mock_yaml_parse.assert_called_once_with(mock_open_file())
186186

187187
@patch("data_diff.dbt.yaml.safe_load")
@@ -203,7 +203,7 @@ def test_set_connection_snowflake_no_password(self, mock_open_file, mock_yaml_pa
203203
with self.assertRaises(Exception):
204204
DbtParser.set_connection(mock_self)
205205

206-
mock_open_file.assert_called_once_with(PROFILES_FILE)
206+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
207207
mock_yaml_parse.assert_called_once_with(mock_open_file())
208208
self.assertNotIsInstance(mock_self.connection, dict)
209209

@@ -238,7 +238,7 @@ def test_set_connection_bigquery(self, mock_open_file, mock_yaml_parse):
238238
self.assertEqual(mock_self.connection.get("driver"), expected_driver)
239239
self.assertEqual(mock_self.connection.get("project"), expected_project)
240240
self.assertEqual(mock_self.connection.get("dataset"), expected_dataset)
241-
mock_open_file.assert_called_once_with(PROFILES_FILE)
241+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
242242
mock_yaml_parse.assert_called_once_with(mock_open_file())
243243

244244
@patch("data_diff.dbt.yaml.safe_load")
@@ -269,7 +269,7 @@ def test_set_connection_bigquery_not_oauth(self, mock_open_file, mock_yaml_parse
269269
with self.assertRaises(Exception):
270270
DbtParser.set_connection(mock_self)
271271

272-
mock_open_file.assert_called_once_with(PROFILES_FILE)
272+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
273273
mock_yaml_parse.assert_called_once_with(mock_open_file())
274274
self.assertNotIsInstance(mock_self.connection, dict)
275275

@@ -296,7 +296,7 @@ def test_set_connection_key_error(self, mock_open_file, mock_yaml_parse):
296296
with self.assertRaises(Exception):
297297
DbtParser.set_connection(mock_self)
298298

299-
mock_open_file.assert_called_once_with(PROFILES_FILE)
299+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
300300
mock_yaml_parse.assert_called_once_with(mock_open_file())
301301
self.assertNotIsInstance(mock_self.connection, dict)
302302

@@ -323,7 +323,7 @@ def test_set_connection_not_implemented(self, mock_open_file, mock_yaml_parse):
323323
with self.assertRaises(NotImplementedError):
324324
DbtParser.set_connection(mock_self)
325325

326-
mock_open_file.assert_called_once_with(PROFILES_FILE)
326+
mock_open_file.assert_called_once_with(Path(PROFILES_FILE))
327327
mock_yaml_parse.assert_called_once_with(mock_open_file())
328328
self.assertNotIsInstance(mock_self.connection, dict)
329329

0 commit comments

Comments
 (0)