From 4188e7d5132ad53215105c63da6547c1a6f2b2d1 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 29 Sep 2025 16:08:03 +0530 Subject: [PATCH 1/6] Fixed Task 2365 ## Dev Board Ticket https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2365 ## Changes - Upgraded the package from `0.2.13` to `o.2.14` ## Testing - TDEI Portal --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e3c6fb2..7790efc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ python-ms-core==0.0.23 uvicorn==0.20.0 html_testRunner==1.2.1 geopandas==0.14.4 -python-osw-validation==0.2.13 \ No newline at end of file +python-osw-validation==0.2.14 \ No newline at end of file From aaa15d69798c8df43ddb503eb3819de34e97c46b Mon Sep 17 00:00:00 2001 From: sujata-m Date: Thu, 11 Dec 2025 15:52:54 +0530 Subject: [PATCH 2/6] Fixed Task 2707 ## Dev Board Ticket https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2707 ## Changes - Upgraded the package from `0.2.14` to `0.3.0` ## Testing - TDEI Portal --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7790efc..1b8bbdd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ python-ms-core==0.0.23 uvicorn==0.20.0 html_testRunner==1.2.1 geopandas==0.14.4 -python-osw-validation==0.2.14 \ No newline at end of file +python-osw-validation==0.3.0 \ No newline at end of file From 89cd5fb26a03724484775605b107d61cfe258047 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Thu, 11 Dec 2025 16:20:20 +0530 Subject: [PATCH 3/6] Fixed unit test cases --- tests/unit_tests/test_validation.py | 30 ++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/unit_tests/test_validation.py b/tests/unit_tests/test_validation.py index aa3cbde..7df6ac0 100644 --- a/tests/unit_tests/test_validation.py +++ b/tests/unit_tests/test_validation.py @@ -89,20 +89,36 @@ def test_validate_invalid_file_with_errors(self, mock_download_file, mock_clean_ """Test the validate method for a invalid file.""" mock_download_file.return_value = f'{SAVED_FILE_PATH}/{FAILURE_FILE_NAME}' error_in_file = 'wa.microsoft.graph.edges.OSW.geojson' - feature_indexes = [3, 6, 8, 25] - error_message = "Additional properties are not allowed ('crossing' was unexpected)" + expected_errors = [ + { + 'feature_index': 3, + 'error_message': '"highway" is a required property' + }, + { + 'feature_index': 6, + 'error_message': '"highway" is a required property' + }, + { + 'feature_index': 8, + 'error_message': '"highway" is a required property' + }, + { + 'feature_index': 25, + 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" + } + ] # Act result = self.validation.validate(max_errors=10) # Assert that validation is marked as valid self.assertFalse(result.is_valid) errors = json.loads(result.validation_message) - count = 0 - for error in errors: + self.assertEqual(len(errors), len(expected_errors)) + + for expected, error in zip(expected_errors, errors): self.assertEqual(error['filename'], error_in_file) - self.assertEqual(error['error_message'][0], error_message) - self.assertEqual(error['feature_index'], feature_indexes[count]) - count += 1 + self.assertEqual(error['feature_index'], expected['feature_index']) + self.assertEqual(error['error_message'][0], expected['error_message']) # Ensure clean_up is called twice (once for the file, once for the folder) self.assertEqual(mock_clean_up.call_count, 2) From 150f525ce236285915bc4bfc55e857e4307f5223 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 15 Dec 2025 18:05:17 +0530 Subject: [PATCH 4/6] BUGFIX-2737 ## Dev Board Ticket https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2737 ## Changes - Updated the `python-osw-validation` package version from `0.3.0` to `0.3.1` ## Testing - TDEI Portal --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1b8bbdd..d6fb46f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ python-ms-core==0.0.23 uvicorn==0.20.0 html_testRunner==1.2.1 geopandas==0.14.4 -python-osw-validation==0.3.0 \ No newline at end of file +python-osw-validation==0.3.1 \ No newline at end of file From c5af4cea71c626afc15a908d8b68e4c6942aec8f Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 15 Dec 2025 18:18:39 +0530 Subject: [PATCH 5/6] Updated unit test cases --- tests/unit_tests/test_config.py | 8 ++++++-- tests/unit_tests/test_validation.py | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py index 886199f..65f9bd4 100644 --- a/tests/unit_tests/test_config.py +++ b/tests/unit_tests/test_config.py @@ -2,6 +2,7 @@ import unittest from unittest.mock import patch from src.config import Settings +import importlib class TestSettings(unittest.TestCase): @@ -34,9 +35,12 @@ def test_settings_with_invalid_auth_simulate(self): settings = Settings() self.assertEqual(settings.auth_provider, 'Hosted') - @patch.dict(os.environ, {}, clear=True) + @patch.dict(os.environ, {'CONTAINER_NAME': 'osw'}, clear=True) def test_default_settings(self): - settings = Settings() + # Reload config to pick up the patched environment and bypass .env values + from src import config + importlib.reload(config) + settings = config.Settings() self.assertEqual(settings.app_name, 'python-osw-validation') self.assertEqual(settings.event_bus.container_name, 'osw') self.assertIsNone(settings.auth_permission_url) diff --git a/tests/unit_tests/test_validation.py b/tests/unit_tests/test_validation.py index 7df6ac0..19f3099 100644 --- a/tests/unit_tests/test_validation.py +++ b/tests/unit_tests/test_validation.py @@ -92,19 +92,23 @@ def test_validate_invalid_file_with_errors(self, mock_download_file, mock_clean_ expected_errors = [ { 'feature_index': 3, - 'error_message': '"highway" is a required property' + 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" }, { 'feature_index': 6, - 'error_message': '"highway" is a required property' + 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" }, { 'feature_index': 8, - 'error_message': '"highway" is a required property' + 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" }, { 'feature_index': 25, 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" + }, + { + 'feature_index': 27, + 'error_message': "Additional properties are not allowed ('crossing' was unexpected)" } ] # Act From 8fad2df803e680a87892e5e87ecbca057138c81f Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 15 Dec 2025 22:23:45 +0530 Subject: [PATCH 6/6] Updated validation package for better error handling ## Dev Board Ticket N/A ## Changes - Updated the `python-osw-validation` package version from `0.3.1` to `0.3.2` - Updated unit test cases ## Testing - TDEI Portal --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d6fb46f..aa22a5a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ python-ms-core==0.0.23 uvicorn==0.20.0 html_testRunner==1.2.1 geopandas==0.14.4 -python-osw-validation==0.3.1 \ No newline at end of file +python-osw-validation==0.3.2 \ No newline at end of file