9856 fix graphiql test

This commit is contained in:
Arthur 2024-03-13 11:19:54 -07:00
parent 347e453b7d
commit 634f35a972
2 changed files with 1 additions and 10 deletions

View File

@ -36,12 +36,6 @@ class NetBoxGraphQLView(GraphQLView):
# Enforce LOGIN_REQUIRED # Enforce LOGIN_REQUIRED
if settings.LOGIN_REQUIRED and not request.user.is_authenticated: if settings.LOGIN_REQUIRED and not request.user.is_authenticated:
return redirect_to_login(reverse('graphql'))
# If this is a human user, send a redirect to the login page
# bug - todo?
# if self.request_wants_html(request):
# return redirect_to_login(reverse('graphql'))
return HttpResponseForbidden("No credentials provided.")
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)

View File

@ -15,8 +15,6 @@ class GraphQLTestCase(TestCase):
response = self.client.get(url) response = self.client.get(url)
self.assertHttpStatus(response, 404) self.assertHttpStatus(response, 404)
'''
BUG TODO - Re-enable
@override_settings(LOGIN_REQUIRED=True) @override_settings(LOGIN_REQUIRED=True)
def test_graphiql_interface(self): def test_graphiql_interface(self):
""" """
@ -36,4 +34,3 @@ class GraphQLTestCase(TestCase):
response = self.client.get(url, **header) response = self.client.get(url, **header)
with disable_warnings('django.request'): with disable_warnings('django.request'):
self.assertHttpStatus(response, 302) # Redirect to login page self.assertHttpStatus(response, 302) # Redirect to login page
'''