Пример #1
0
 def test_scrape_route(self):
     provider = CloudAmberBusRouteProvider('foo')
     provider._get_entity = mock.Mock(return_value='bar')
     StopOnRoute.objects.create = mock.Mock()
     provider._scrape_route(
         6, 'molly/apps/places/tests/data/cloudamber-route.html')
     self.assertEqual(StopOnRoute.objects.create.call_count, 18)
Пример #2
0
 def test_scrape_search(self):
     provider = CloudAmberBusRouteProvider('foo')
     provider.url = 'molly/apps/places/tests/data/cloudamber-search.html'
     provider._scrape_route = mock.Mock()
     Route.objects.get_or_create = mock.Mock(return_value=[mock.Mock(), True])
     provider._scrape_search()
     # Attempts to create 200 routes
     self.assertEqual(Route.objects.get_or_create.call_count, 201)
Пример #3
0
 def test_scrape_search(self):
     provider = CloudAmberBusRouteProvider('foo')
     provider.url = 'molly/apps/places/tests/data/cloudamber-search.html'
     provider._scrape_route = mock.Mock()
     Route.objects.get_or_create = mock.Mock(
         return_value=[mock.Mock(), True])
     provider._scrape_search()
     # Attempts to create 200 routes
     self.assertEqual(Route.objects.get_or_create.call_count, 201)
Пример #4
0
 def test_scrape_route(self):
     provider = CloudAmberBusRouteProvider('foo')
     provider._get_entity = mock.Mock(return_value='bar')
     StopOnRoute.objects.create = mock.Mock()
     provider._scrape_route(6, 'molly/apps/places/tests/data/cloudamber-route.html')
     self.assertEqual(StopOnRoute.objects.create.call_count, 18)