From dc43df83006a7f387769aa829f647ca1d68eea93 Mon Sep 17 00:00:00 2001 From: Caleb Schilly Date: Fri, 2 Aug 2024 14:01:15 -0400 Subject: [PATCH] #523: update JSON validator test with new args --- .../test_JSON_data_files_validator.py | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/tests/unit/imported/test_JSON_data_files_validator.py b/tests/unit/imported/test_JSON_data_files_validator.py index 09e8923e4..e39487ddf 100644 --- a/tests/unit/imported/test_JSON_data_files_validator.py +++ b/tests/unit/imported/test_JSON_data_files_validator.py @@ -40,7 +40,9 @@ def test_json_data_files_validator_file(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.file_path, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_dir(self): @@ -48,7 +50,9 @@ def test_json_data_files_validator_dir(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.dir_path, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_dir_compressed(self): @@ -56,7 +60,9 @@ def test_json_data_files_validator_dir_compressed(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.dir_path_compressed, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_stats_001(self): @@ -64,7 +70,9 @@ def test_json_data_files_validator_file_stats_001(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.stats_file_001, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_stats_002(self): @@ -72,7 +80,9 @@ def test_json_data_files_validator_file_stats_002(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.stats_file_002, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_stats_003(self): @@ -80,7 +90,9 @@ def test_json_data_files_validator_file_stats_003(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.stats_file_003, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_stats_004(self): @@ -88,13 +100,17 @@ def test_json_data_files_validator_file_stats_004(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.stats_file_004, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_stats_no_schema_type(self): argparse.ArgumentParser.parse_args = Mock() argparse.ArgumentParser.parse_args.return_value = argparse.Namespace( - file_path=self.vt_lb_statistics_no_schema_type, dir_path=None, file_prefix=None, file_suffix=None) + file_path=self.vt_lb_statistics_no_schema_type, dir_path=None, file_prefix=None, file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_prefix(self): @@ -102,7 +118,9 @@ def test_json_data_files_validator_prefix(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.dir_path, file_prefix="data", - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_suffix(self): @@ -110,7 +128,9 @@ def test_json_data_files_validator_suffix(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.dir_path, file_prefix=None, - file_suffix="json") + file_suffix="json", + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_prefix_suffix(self): @@ -118,7 +138,9 @@ def test_json_data_files_validator_prefix_suffix(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.dir_path, file_prefix="data", - file_suffix="json") + file_suffix="json", + validate_comm_links=False, + debug=False) JSONDataFilesValidator().main() def test_json_data_files_validator_file_not_found(self): @@ -126,7 +148,9 @@ def test_json_data_files_validator_file_not_found(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.wrong_file_path, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) with self.assertRaises(FileNotFoundError) as err: JSONDataFilesValidator().main() self.assertEqual(err.exception.args[0], f"File: {self.wrong_file_path} NOT found") @@ -136,7 +160,9 @@ def test_json_data_files_validator_dir_not_found(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=self.wrong_dir_path, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) with self.assertRaises(FileNotFoundError) as err: JSONDataFilesValidator().main() self.assertEqual(err.exception.args[0], f"Directory: {self.wrong_dir_path} does NOT exist") @@ -146,7 +172,9 @@ def test_json_data_files_validator_no_args(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=None, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) with self.assertRaises(Exception) as err: JSONDataFilesValidator().main() self.assertEqual(err.exception.args[0], "FILE path or DIRECTORY path has to be given") @@ -156,7 +184,9 @@ def test_json_data_files_validator_wrong_file_schema(self): argparse.ArgumentParser.parse_args.return_value = argparse.Namespace(file_path=self.wrong_file_schema, dir_path=None, file_prefix=None, - file_suffix=None) + file_suffix=None, + validate_comm_links=False, + debug=False) with self.assertRaises(SchemaError) as err: JSONDataFilesValidator().main() with open(os.path.join(self.data_dir, "JSON_data_file_validator_wrong", "schema_error.txt"), "rt") as se: