Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespfennell committed Apr 17, 2020
1 parent b6f3a14 commit 72ca89a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tests/db/test_stopdam.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,13 @@ def test_list_all_stops_in_stop_tree(add_model, system_1, base_pk):
actual_pks = {stop.pk for stop in stopdam.list_all_stops_in_stop_tree(base_pk)}

assert expected_pks == actual_pks


def test_list_direction_rules(add_model, stop_1_1, stop_1_2, stop_1_3):
rule_1 = add_model(models.DirectionRule(stop=stop_1_1))
rule_2 = add_model(models.DirectionRule(stop=stop_1_2))
add_model(models.DirectionRule(stop=stop_1_3))

assert [rule_1, rule_2] == stopdam.list_direction_rules_for_stops(
[stop_1_1.pk, stop_1_2.pk]
)
5 changes: 3 additions & 2 deletions tests/unit/services/test_stopservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_get_in_system_by_id__stop_not_found(monkeypatch):
stopservice.get_in_system_by_id(SYSTEM_ID, STOP_ONE_ID),


def test_get_in_system_by_id(monkeypatch,):
def test_get_in_system_by_id(monkeypatch):
stop_one = models.Stop(
pk=STOP_ONE_PK, id=STOP_ONE_ID, system=models.System(id=SYSTEM_ID),
)
Expand All @@ -147,6 +147,7 @@ def test_get_in_system_by_id(monkeypatch,):
monkeypatch.setattr(
stopdam, "list_all_stops_in_stop_tree", lambda *args: [stop_one]
)
monkeypatch.setattr(stopdam, "list_direction_rules_for_stops", lambda *args: [])
monkeypatch.setattr(
stopdam,
"list_stop_time_updates_at_stops",
Expand Down Expand Up @@ -178,7 +179,7 @@ def test_get_in_system_by_id(monkeypatch,):
expected = {
**fake_stop_tree_response,
"directions": [DIRECTION_NAME],
"stop_times": [{**fake_trip_stop_time_response},],
"stop_times": [{**fake_trip_stop_time_response}],
"latitude": None,
"longitude": None,
"url": None,
Expand Down
1 change: 0 additions & 1 deletion transiter/services/stopservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def get_in_system_by_id(
"""
Get information about a specific stop.
"""

stop = stopdam.get_in_system_by_id(system_id, stop_id)
if stop is None:
raise exceptions.IdNotFoundError
Expand Down

0 comments on commit 72ca89a

Please sign in to comment.