Skip to content

Commit

Permalink
Unit test for show_markers and show_routes traitlets
Browse files Browse the repository at this point in the history
  • Loading branch information
pbugnion committed Apr 21, 2018
1 parent 50f060b commit 2f8e211
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion gmaps/tests/test_directions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import traitlets

from ..directions import Directions
from ..directions import Directions, DEFAULT_STROKE_COLOR


class DirectionsLayer(unittest.TestCase):
Expand All @@ -25,6 +25,11 @@ def test_defaults(self):
assert not state['avoid_highways']
assert not state['avoid_tolls']
assert not state['optimize_waypoints']
assert state['show_markers']
assert state['show_route']
assert state['stroke_color'].lower() == DEFAULT_STROKE_COLOR.lower()
assert state['stroke_opacity'] == 0.6
assert state['stroke_weight'] == 6.0

def test_pass_args(self):
layer = Directions(self.start, self.end)
Expand Down Expand Up @@ -90,6 +95,23 @@ def test_boolean_options(self):
assert state['avoid_tolls']
assert state['optimize_waypoints']

def test_show_markers_routes(self):
layer = Directions(
self.start, self.end,
show_markers=False,
show_route=False
)
state = layer.get_state()
assert not state['show_markers']
assert not state['show_route']

def test_change_markers_routes(self):
layer = Directions(self.start, self.end)
layer.show_markers = False
assert not layer.get_state()['show_markers']
layer.show_route = False
assert not layer.get_state()['show_route']

def test_travel_mode(self):
layer = Directions(self.start, self.end, travel_mode='BICYCLING')
assert layer.travel_mode == 'BICYCLING'
Expand Down

0 comments on commit 2f8e211

Please sign in to comment.