Skip to content
Snippets Groups Projects
Commit 308c592e authored by James Graham's avatar James Graham
Browse files

Merge branch 'dev'

parents ef8bcfa7 6ae233cf
No related branches found
No related tags found
No related merge requests found
import typing import typing
import unittest
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.test import Client, TestCase from django.test import Client, TestCase
...@@ -554,6 +556,8 @@ class DataSourceApiHyperCatTest(TestCase): ...@@ -554,6 +556,8 @@ class DataSourceApiHyperCatTest(TestCase):
self.assertLessEqual(1, len(data['data'])) self.assertLessEqual(1, len(data['data']))
# TODO test contents of 'data' list # TODO test contents of 'data' list
# CityVerve API is discontinued
@unittest.expectedFailure
def test_api_datasource_get_dataset_metadata(self): def test_api_datasource_get_dataset_metadata(self):
""" """
Test the :class:`DataSource` API functionality to retrieve dataset metadata. Test the :class:`DataSource` API functionality to retrieve dataset metadata.
...@@ -569,6 +573,8 @@ class DataSourceApiHyperCatTest(TestCase): ...@@ -569,6 +573,8 @@ class DataSourceApiHyperCatTest(TestCase):
self.assertLessEqual(1, len(data['data'])) self.assertLessEqual(1, len(data['data']))
# TODO test contents of 'data' list # TODO test contents of 'data' list
# CityVerve API is discontinued
@unittest.expectedFailure
def test_api_datasource_get_dataset_data(self): def test_api_datasource_get_dataset_data(self):
""" """
Test the :class:`DataSource` API functionality to retrieve dataset data. Test the :class:`DataSource` API functionality to retrieve dataset data.
......
...@@ -8,7 +8,9 @@ import typing ...@@ -8,7 +8,9 @@ import typing
from django.db.models import ObjectDoesNotExist from django.db.models import ObjectDoesNotExist
from django.http import HttpResponse, JsonResponse from django.http import HttpResponse, JsonResponse
from rest_framework import decorators, request, response, viewsets from rest_framework import decorators, request, response, viewsets
from requests.exceptions import HTTPError
from .. import permissions from .. import permissions
from datasources import models, serializers from datasources import models, serializers
...@@ -134,6 +136,10 @@ class DataSourceApiViewset(viewsets.ReadOnlyModelViewSet): ...@@ -134,6 +136,10 @@ class DataSourceApiViewset(viewsets.ReadOnlyModelViewSet):
} }
return response.Response(data, status=400) return response.Response(data, status=400)
except HTTPError as e:
# Pass upstream errors through
return response.Response(e.response.text, status=e.response.status_code)
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
""" """
List the queryset after filtering by request query parameters for data source metadata. List the queryset after filtering by request query parameters for data source metadata.
......
import itertools import itertools
import typing import typing
import unittest
from django.test import TestCase from django.test import TestCase
...@@ -157,6 +158,8 @@ class ConnectorHyperCatTest(TestCase): ...@@ -157,6 +158,8 @@ class ConnectorHyperCatTest(TestCase):
self.assertEqual(k, self.assertEqual(k,
v.location) v.location)
# CityVerve API is discontinued
@unittest.expectedFailure
def test_plugin_get_subcatalogue_metadata(self): def test_plugin_get_subcatalogue_metadata(self):
connection = self._get_connection() connection = self._get_connection()
...@@ -179,6 +182,8 @@ class ConnectorHyperCatTest(TestCase): ...@@ -179,6 +182,8 @@ class ConnectorHyperCatTest(TestCase):
self.assertEqual('https://developer.cityverve.org.uk', self.assertEqual('https://developer.cityverve.org.uk',
_get_item_by_key_value(result, 'rel', 'urn:X-hypercat:rels:hasHomepage')['val']) _get_item_by_key_value(result, 'rel', 'urn:X-hypercat:rels:hasHomepage')['val'])
# CityVerve API is discontinued
@unittest.expectedFailure
def test_plugin_get_subcatalogue_datasets(self): def test_plugin_get_subcatalogue_datasets(self):
connection = self._get_connection() connection = self._get_connection()
...@@ -200,6 +205,8 @@ class ConnectorHyperCatTest(TestCase): ...@@ -200,6 +205,8 @@ class ConnectorHyperCatTest(TestCase):
for exp in expected: for exp in expected:
self.assertIn(exp, datasets) self.assertIn(exp, datasets)
# CityVerve API is discontinued
@unittest.expectedFailure
def test_plugin_get_subcatalogue_dataset_metadata(self): def test_plugin_get_subcatalogue_dataset_metadata(self):
connection = self._get_connection() connection = self._get_connection()
...@@ -228,6 +235,8 @@ class ConnectorHyperCatTest(TestCase): ...@@ -228,6 +235,8 @@ class ConnectorHyperCatTest(TestCase):
self.assertEqual('polling-station', self.assertEqual('polling-station',
_get_item_by_key_value(result, 'rel', 'urn:X-cityverve:rels:type')['val']) _get_item_by_key_value(result, 'rel', 'urn:X-cityverve:rels:type')['val'])
# CityVerve API is discontinued
@unittest.expectedFailure
def test_plugin_get_subcatalogue_dataset_data(self): def test_plugin_get_subcatalogue_dataset_data(self):
connection = self._get_connection() connection = self._get_connection()
......
...@@ -8,7 +8,7 @@ chardet==3.0.4 ...@@ -8,7 +8,7 @@ chardet==3.0.4
decorator==4.3.0 decorator==4.3.0
defusedxml==0.5.0 defusedxml==0.5.0
dj-database-url==0.5.0 dj-database-url==0.5.0
Django==2.0.8 Django==2.0.13
django-bootstrap4==0.0.6 django-bootstrap4==0.0.6
django-cors-headers==2.4.0 django-cors-headers==2.4.0
django-haystack==2.8.1 django-haystack==2.8.1
...@@ -44,7 +44,7 @@ python-decouple==3.1 ...@@ -44,7 +44,7 @@ python-decouple==3.1
python3-openid==3.1.0 python3-openid==3.1.0
pytz==2018.5 pytz==2018.5
rdflib==4.2.2 rdflib==4.2.2
requests==2.19.1 requests==2.21.0
requests-oauthlib==1.0.0 requests-oauthlib==1.0.0
six==1.11.0 six==1.11.0
snowballstemmer==1.2.1 snowballstemmer==1.2.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment