def test_routes_points_builder_wps_correct_too_many_vwps(): waypoints = [{"45": "-74"}, {"46": "-75"}] viawaypoints = [{"45.5": "-74.5"}, {"45.6": "-74.6"}] # should automatically disregard the extra viawaypoints dictionary points = rts.build_routes_points(waypoints, viawaypoints) check = "wp.0=45,-74&vwp.1=45.5,-74.5&wp.2=46,-75&" assert (points == check)
def test_format_routes_query_valid_points_default_inputs(): waypoints = [{"45": "-74"}, {"46": "-75"}] viawaypoints = [{"45.5": "-74.5"}] points = rts.build_routes_points(waypoints, viawaypoints) query = rts.format_routes_query(points) check = "Routes?wp.0=45,-74&vwp.1=45.5,-74.5&wp.2=46,-75&"+\ "routeAttributes={}&distanceUnit={}".format("routePath", "km") assert (query == check)
def test_routes_points_builder_no_inputs(): waypoints = [{}] viawaypoints = [{}] points = rts.build_routes_points(waypoints, viawaypoints) check = "" assert (points == check)
def test_routes_points_builder_wps_no_vwps(): waypoints = [{"45": "-74"}, {"46": "-75"}] viawaypoints = [{}] points = rts.build_routes_points(waypoints, viawaypoints) check = "wp.0=45,-74&wp.1=46,-75&" assert (points == check)
def test_routes_points_builder_wps_vwps_correct(): waypoints = [{"45": "-74"}, {"46": "-75"}] viawaypoints = [{"45.5": "-74.5"}] points = rts.build_routes_points(waypoints, viawaypoints) check = "wp.0=45,-74&vwp.1=45.5,-74.5&wp.2=46,-75&" assert (points == check)