diff --git a/backend/api/urls.py b/backend/api/urls.py index 2520249f..9bc80085 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -1,8 +1,7 @@ from django.urls import include, path from .views import (annotation, auto_labeling, comment, example, example_state, - export_dataset, health, import_export, label, project, tag, - task) + export_dataset, health, label, project, tag, task) from .views.tasks import category, relation, span, text urlpatterns_project = [ @@ -204,11 +203,6 @@ urlpatterns = [ view=health.Health.as_view(), name='health' ), - path( - route='features', - view=import_export.Features.as_view(), - name='features' - ), path( route='projects', view=project.ProjectList.as_view(), diff --git a/backend/api/views/import_export.py b/backend/api/views/import_export.py deleted file mode 100644 index c1198928..00000000 --- a/backend/api/views/import_export.py +++ /dev/null @@ -1,64 +0,0 @@ -from django.conf import settings -from rest_framework.permissions import IsAuthenticated -from rest_framework.response import Response -from rest_framework.views import APIView - - -class Features(APIView): - permission_classes = (IsAuthenticated,) - - def get(self, request, *args, **kwargs): - return Response({ - 'cloud_upload': bool(settings.CLOUD_BROWSER_APACHE_LIBCLOUD_PROVIDER), - }) - - -# class CloudUploadAPI(APIView): -# permission_classes = TextUploadAPI.permission_classes -# -# def get(self, request, *args, **kwargs): -# try: -# project_id = request.query_params['project_id'] -# file_format = request.query_params['upload_format'] -# cloud_container = request.query_params['container'] -# cloud_object = request.query_params['object'] -# except KeyError as ex: -# raise ValidationError('query parameter {} is missing'.format(ex)) -# -# try: -# cloud_file = self.get_cloud_object_as_io(cloud_container, cloud_object) -# except ContainerDoesNotExistError: -# raise ValidationError('cloud container {} does not exist'.format(cloud_container)) -# except ObjectDoesNotExistError: -# raise ValidationError('cloud object {} does not exist'.format(cloud_object)) -# -# TextUploadAPI.save_file( -# user=request.user, -# file=cloud_file, -# file_format=file_format, -# project_id=project_id, -# ) -# -# next_url = request.query_params.get('next') -# -# if next_url == 'about:blank': -# return Response(data='', content_type='text/plain', status=status.HTTP_201_CREATED) -# -# if next_url: -# return redirect(next_url) -# -# return Response(status=status.HTTP_201_CREATED) -# -# @classmethod -# def get_cloud_object_as_io(cls, container_name, object_name): -# provider = settings.CLOUD_BROWSER_APACHE_LIBCLOUD_PROVIDER.lower() -# account = settings.CLOUD_BROWSER_APACHE_LIBCLOUD_ACCOUNT -# key = settings.CLOUD_BROWSER_APACHE_LIBCLOUD_SECRET_KEY -# -# driver = get_driver(DriverType.STORAGE, provider) -# client = driver(account, key) -# -# cloud_container = client.get_container(container_name) -# cloud_object = cloud_container.get_object(object_name) -# -# return iterable_to_io(cloud_object.as_stream()) diff --git a/backend/data_import/tests/test_views.py b/backend/data_import/tests/test_views.py index 6bc1b6d2..11a72650 100644 --- a/backend/data_import/tests/test_views.py +++ b/backend/data_import/tests/test_views.py @@ -1,23 +1,8 @@ -from django.test import override_settings from rest_framework import status from rest_framework.reverse import reverse from api.models import DOCUMENT_CLASSIFICATION -from api.tests.api.utils import CRUDMixin, create_default_roles, make_user, prepare_project - - -class TestFeatures(CRUDMixin): - - @classmethod - def setUpTestData(cls): - create_default_roles() - cls.user = make_user() - cls.url = reverse('features') - - @override_settings(CLOUD_BROWSER_APACHE_LIBCLOUD_PROVIDER=None) - def test_no_cloud_upload(self): - response = self.assert_fetch(self.user, status.HTTP_200_OK) - self.assertFalse(response.json().get('cloud_upload')) +from api.tests.api.utils import CRUDMixin, prepare_project class TestImportCatalog(CRUDMixin):