From 5cfb22d342f5a84dd7139176a28d235c292cfccc Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Fri, 26 Oct 2018 13:54:29 -0700 Subject: [PATCH] Missing tzid property wasn't a geojson validation issue, shouldn't have been tested there. --- include/util/geojson_validation.hpp | 14 -------------- unit_tests/updater/timezoner.cpp | 14 ++++++++++++++ unit_tests/updater/validation.cpp | 16 ---------------- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/include/util/geojson_validation.hpp b/include/util/geojson_validation.hpp index 56e85deb1..8482395be 100644 --- a/include/util/geojson_validation.hpp +++ b/include/util/geojson_validation.hpp @@ -48,20 +48,6 @@ inline void validateFeature(const rapidjson::Value &feature) { throw osrm::util::exception("Feature has non-object properties member."); } - if (feature["properties"].HasMember("tzid")) - { - if (!feature["properties"]["tzid"].IsString()) - throw osrm::util::exception("Feature has non-string tzid property"); - } - else if (feature["properties"].HasMember("TZID")) - { - if (!feature["properties"]["TZID"].IsString()) - throw osrm::util::exception("Feature has non-string TZID property"); - } - else - { - throw osrm::util::exception("Feature is missing tzid property."); - } if (!feature.HasMember("geometry")) { throw osrm::util::exception("Feature is missing geometry member."); diff --git a/unit_tests/updater/timezoner.cpp b/unit_tests/updater/timezoner.cpp index 543c14312..9f4a3744a 100644 --- a/unit_tests/updater/timezoner.cpp +++ b/unit_tests/updater/timezoner.cpp @@ -53,5 +53,19 @@ BOOST_AUTO_TEST_CASE(timezoner_test) "48.88277], [8.57757, 49.07206], [8.28369, " "49.07206], [8.28369, 48.88277]]] }} ]}"; BOOST_CHECK_THROW(Timezoner tz(missing_featc, now), util::exception); + + char missing_tzid[] = "{ \"type\" : \"Feature\"," + "\"properties\" : { }, \"geometry\" : { \"type\": \"polygon\", " + "\"coordinates\": [[[8.28369,48.88277], [8.57757, " + "48.88277], [8.57757, 49.07206], [8.28369, " + "49.07206], [8.28369, 48.88277]]] }}"; + BOOST_CHECK_THROW(Timezoner tz(missing_tzid, now), util::exception); + + char tzid_err[] = "{ \"type\" : \"Feature\"," + "\"properties\" : { \"TZID\" : []}, \"geometry\" : { \"type\": \"polygon\", " + "\"coordinates\": [[[8.28369,48.88277], [8.57757, " + "48.88277], [8.57757, 49.07206], [8.28369, " + "49.07206], [8.28369, 48.88277]]] }}"; + BOOST_CHECK_THROW(Timezoner tz(tzid_err, now), util::exception); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/updater/validation.cpp b/unit_tests/updater/validation.cpp index b68c34528..177dc52d5 100644 --- a/unit_tests/updater/validation.cpp +++ b/unit_tests/updater/validation.cpp @@ -65,22 +65,6 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test) doc.Parse(nonobj_props); BOOST_CHECK_THROW(util::validateFeature(doc), util::exception); - char missing_tzid[] = "{ \"type\" : \"Feature\"," - "\"properties\" : { }, \"geometry\" : { \"type\": \"polygon\", " - "\"coordinates\": [[[8.28369,48.88277], [8.57757, " - "48.88277], [8.57757, 49.07206], [8.28369, " - "49.07206], [8.28369, 48.88277]]] }}"; - doc.Parse(missing_tzid); - BOOST_CHECK_THROW(util::validateFeature(doc), util::exception); - - char tzid_err[] = "{ \"type\" : \"Feature\"," - "\"properties\" : { \"TZID\" : []}, \"geometry\" : { \"type\": \"polygon\", " - "\"coordinates\": [[[8.28369,48.88277], [8.57757, " - "48.88277], [8.57757, 49.07206], [8.28369, " - "49.07206], [8.28369, 48.88277]]] }}"; - doc.Parse(tzid_err); - BOOST_CHECK_THROW(util::validateFeature(doc), util::exception); - char missing_geom[] = "{ \"type\" : \"Feature\"," "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometries\" : { " "\"type\": \"polygon\", "