diff --git a/enterprise/api/v1/views.py b/enterprise/api/v1/views.py index bb7793f20a..77389caf2f 100644 --- a/enterprise/api/v1/views.py +++ b/enterprise/api/v1/views.py @@ -534,7 +534,7 @@ def algolia_key(self, request, *args, **kwargs): """ if not settings.ENTERPRISE_ALGOLIA_SEARCH_API_KEY: - raise ValidationError("Algolia API key not configured.", code=HTTP_500_INTERNAL_SERVER_ERROR) + return Response("Algolia API key not configured", status=status.HTTP_500_INTERNAL_SERVER_ERROR) queryset = self.queryset.filter( **{ @@ -544,7 +544,7 @@ def algolia_key(self, request, *args, **kwargs): ).values_list("uuid", flat=True) if len(queryset) == 0: - raise ValidationError("User is not linked to any enterprise customers.", code=HTTP_404_NOT_FOUND) + raise NotFound("User is not linked to any enterprise customers.") secured_key = SearchClient.generate_secured_api_key( settings.ENTERPRISE_ALGOLIA_SEARCH_API_KEY, diff --git a/enterprise/settings/test.py b/enterprise/settings/test.py index 9a53f10e0d..50fd95e46e 100644 --- a/enterprise/settings/test.py +++ b/enterprise/settings/test.py @@ -219,6 +219,8 @@ def root(*args): 'status': 'published' } +ENTERPRISE_ALGOLIA_SEARCH_API_KEY = 'test' + SNOWFLAKE_SERVICE_USER = 'TEST@EDX.ORG' SNOWFLAKE_SERVICE_USER_PASSWORD = 'secret'