def test_stops_method_with_xml_format(self): b = Bongo('xml') b.stops() self.get.return_value = Mock() params = {'format': 'xml'} endpoint = 'http://ebongo.org/api/stoplist' self.get.assert_called_with(endpoint, params=params)
def test_stops_method(self): b = Bongo() b.stops() params = {'format': 'json'} endpoint = 'http://ebongo.org/api/stoplist' self.get.assert_called_with(endpoint, params=params)
def test_specific_stop(self): b = Bongo() b.stop('12345') params = {'format': 'json', 'stopid': '12345'} endpoint = 'http://ebongo.org/api/stop' self.get.assert_called_with(endpoint, params=params)
def test_stop_method_can_take_int_argument(self): b = Bongo() b.stop(12345) params = {'format': 'json', 'stopid': 12345} endpoint = 'http://ebongo.org/api/stop' self.get.assert_called_with(endpoint, params=params)
def test_specific_route(self): b = Bongo() b.route('lantern', 'coralville') params = {'format': 'json', 'route': 'lantern', 'agency': 'coralville'} endpoint = 'http://ebongo.org/api/route' self.get.assert_called_with(endpoint, params=params)
def test_empty_route_method(self): b = Bongo() b.route() params = {'format': 'json'} endpoint = 'http://ebongo.org/api/routelist' self.get.assert_called_with(endpoint, params=params)
def test_format_can_be_passed_as_argument(self): b = Bongo('xml') self.assertEqual(b.format, 'xml')
def test_default_format(self): b = Bongo() self.assertEqual(b.format, 'json')
def test_prediction_for_stop(self): b = Bongo() b.predict(12345) params = {'format': 'json', 'stopid': 12345} endpoint = 'http://ebongo.org/api/prediction' self.get.assert_called_with(endpoint, params=params)