Ejemplo n.º 1
0
def test_station_name():
    httpretty.register_uri(httpretty.GET, BVG_URL, body=STATION_HTML)
    stations, ok = request_station_ids('Weber')
    assert ok is True
    assert len(stations) == 8
    assert len(stations[0]) == 2
Ejemplo n.º 2
0
def test_request_station_timeout():
    httpretty.register_uri(httpretty.GET, BVG_URL, body=mock_timeout_callback)
    _, ok = request_station_ids('any station')
    assert ok is False
Ejemplo n.º 3
0
def test_parameter_station_name():
    httpretty.register_uri(httpretty.GET, BVG_URL, status=201)
    _, ok = request_station_ids('anystation')
    request = httpretty.last_request()
    assert b'input=anystation' in request.body
Ejemplo n.º 4
0
def test_request_station_server_error():
    httpretty.register_uri(httpretty.GET, BVG_URL, status=500)
    _, ok = request_station_ids('any station')
    assert ok is False