Generate Eurostar timetable URLs from station IDs
This commit is contained in:
parent
f75c1e2db3
commit
945d028c13
3 changed files with 40 additions and 24 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
import pytest
|
||||
from scraper.eurostar import _hhmm, _parse
|
||||
from scraper.eurostar import _hhmm, _parse, timetable_url
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -80,3 +80,17 @@ def test_parse_no_next_data_returns_empty():
|
|||
def test_parse_empty_departures():
|
||||
html = _make_next_data([])
|
||||
assert _parse(html, 'Paris Gare du Nord') == []
|
||||
|
||||
|
||||
def test_timetable_url_uses_station_id_table():
|
||||
assert timetable_url('Paris Gare du Nord') == (
|
||||
'https://www.eurostar.com/uk-en/travel-info/timetable/'
|
||||
'7015400/8727100/london-st-pancras-intl/paris-gare-du-nord'
|
||||
)
|
||||
|
||||
|
||||
def test_timetable_url_slugifies_destination_name():
|
||||
assert timetable_url('Rotterdam Centraal') == (
|
||||
'https://www.eurostar.com/uk-en/travel-info/timetable/'
|
||||
'7015400/8400530/london-st-pancras-intl/rotterdam-centraal'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue