예제 #1
0
    def test(self):
        request = mock.Mock()
        expected_response = {'status': 200, 'content': [], 'errors': []}
        
        response = views.bus_stops(request)

        self.assertEqual(json.loads(response.content), expected_response)
예제 #2
0
    def test_with_bus_stops(self):
        request = mock.Mock()
        bus_stop = BusStop.objects.create(naptan_id='asdf', name='asdf', latitude=0.1, longitude=0.2)
        expected_content = [
            {
                'naptan_id': 'asdf',
                'name': 'asdf',
                'latitude': 0.1,
                'longitude': 0.2
            }
        ]
        expected_response = {'status': 200, 'content': expected_content, 'errors': []}

        response = views.bus_stops(request)

        self.assertEqual(json.loads(response.content), expected_response)