def test_check_availability_fails_when_response_does_not_include_layers_object(self, mock_requests_session): mock_response = mock.MagicMock() mock_response.json.return_value = {} mock_requests_session.return_value.get.return_value = mock_response base_url = "http://fake-url2" worker = geonodeharvester.GeonodeLegacyHarvester(base_url, harvester_id=None) result = worker.check_availability() self.assertEqual(result, False)
def test_base_api_url(self): """Base API URL does not have an extra slash, regardless of whether the original URL has it or not""" base_remote_urls = [ ("http://fake-url1", "http://fake-url1/api"), ("http://fake-url2/", "http://fake-url2/api"), ] harvester_id = "fake-id" for base_url, expected in base_remote_urls: worker = geonodeharvester.GeonodeLegacyHarvester(base_url, harvester_id) self.assertEqual(worker.base_api_url, expected)
def test_that_copying_remote_resources_is_allowed(self): worker = geonodeharvester.GeonodeLegacyHarvester("http://fake-url2/", "fake-id") self.assertTrue(worker.allows_copying_resources)