Skip to content

Commit

Permalink
test: cover the new endpoing with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0x29a committed Nov 14, 2023
1 parent 033cbee commit 39a3274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enterprise/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
**{
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions enterprise/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def root(*args):
'status': 'published'
}

ENTERPRISE_ALGOLIA_SEARCH_API_KEY = 'test'

SNOWFLAKE_SERVICE_USER = '[email protected]'
SNOWFLAKE_SERVICE_USER_PASSWORD = 'secret'

Expand Down

0 comments on commit 39a3274

Please sign in to comment.