Explorar o código

9856 fix graphiql test

Arthur hai 1 ano
pai
achega
634f35a972
Modificáronse 2 ficheiros con 1 adicións e 10 borrados
  1. 1 7
      netbox/netbox/graphql/views.py
  2. 0 3
      netbox/netbox/tests/test_graphql.py

+ 1 - 7
netbox/netbox/graphql/views.py

@@ -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:
-
-            # 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 redirect_to_login(reverse('graphql'))
 
 
         return super().dispatch(request, *args, **kwargs)
         return super().dispatch(request, *args, **kwargs)

+ 0 - 3
netbox/netbox/tests/test_graphql.py

@@ -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
-    '''