def xml_date_time_invalid_test():
    builder = Synthese("id_synthese", "http://fake.url/", "Europe/Paris")
    xml = get_xml_parser().replace("2016-Mar-21 12:07:37",
                                   "2016-Mar-41 12:07:37", 1)

    with pytest.raises(ValueError):
        builder._get_synthese_passages(xml)
def xml_valid_test():
    builder = Synthese("id_synthese", "http://fake.url/", "Europe/Paris")
    result = builder._get_synthese_passages(get_xml_parser())
    route_point = SyntheseRoutePoint('2533412229452279', '3377704015495922')

    assert route_point in result
    assert len(result[route_point]) == 1
    assert result[route_point][0].is_real_time == True
    assert result[route_point][0].datetime == make_dt("2016-Mar-21 12:07:37")

    route_point = SyntheseRoutePoint('2533412229399934', '3377704015495922')
    assert route_point in result
    assert len(result[route_point]) == 2
    assert result[route_point][0].is_real_time == True
    assert result[route_point][0].datetime == make_dt("2016-Mar-21 12:15:00")

    assert result[route_point][1].is_real_time == True
    assert result[route_point][1].datetime == make_dt("2016-Mar-22 12:15:00")
def xml_invalid_test():
    builder = Synthese("id_synthese", "http://fake.url/", "Europe/Paris")
    xml = get_xml_parser().replace("</journey>", "", 1)
    with pytest.raises(et.ParseError):
        builder._get_synthese_passages(xml)