def test_get_content_handles_request_exception(self, mock_requests_get,
                                                   mock_config,
                                                   mock_pyopenssl_inject):
        mock_config.return_value = {}

        harvester = CKANHarvester()

        with assert_raises(ContentFetchError) as context:
            harvester._get_content("http://test.example.gov.uk")

        assert str(context.exception) == 'Request error: Test exception'
Exemplo n.º 2
0
    def test_get_content_handles_http_error(self, mock_requests_get,
                                            mock_config,
                                            mock_pyopenssl_inject):
        mock_config.return_value = {}

        harvester = CKANHarvester()

        with pytest.raises(ContentFetchError) as context:
            harvester._get_content("http://test.example.gov.uk")

        assert str(
            context.value) == 'HTTP error: 404 http://test.example.gov.uk'