예제 #1
0
class TestBusStops(unittest.TestCase):
    @patch('api.bus_stops.requests', MockRequests())
    @patch('api.bus_stops.SERVICE_BASE_URL', 'http://test.local')
    @patch('api.bus_stops.BUS_TRACKER', 'bus_tracker.php')
    def setUp(self):
        self.bus_stops = BusStops()
        self.stop_info = self.bus_stops.by_stop_code(1234)

    def test_search_by_stop_id_returns_something(self):
        self.assertIsNotNone(self.stop_info)

    def test_search_by_stop_id_returns_dict(self):
        self.assertEqual(self.stop_info['hello'], 'world')
예제 #2
0
def json_stop(bus_stop_code):
    return jsonify(BusStops().by_stop_code(bus_stop_code))
예제 #3
0
 def setUp(self):
     self.bus_stops = BusStops()
     self.stop_info = self.bus_stops.by_stop_code(1234)