예제 #1
0
def execute_query(request_factory, schema, query, **kwargs):
    view = GraphQLView.as_view(schema=schema, **kwargs)
    request = request_factory.post("/graphql/",
                                   data=query,
                                   content_type="application/json")
    response = view(request)
    return json.loads(response.content)
예제 #2
0
def test_post_request_fails_for_introspection_when_disabled(
        schema, request_factory, snapshot):
    view = GraphQLView.as_view(schema=schema, introspection=False)
    request = request_factory.post(
        "/graphql/",
        data={"query": "{ __schema { types { name } } }"},
        content_type="application/json",
    )
    response = view(request)
    assert response.status_code == 400
    snapshot.assert_match(response.content)
예제 #3
0
def view(schema):
    return GraphQLView.as_view(schema=schema)
예제 #4
0
"""Default urlconf for gentoo_build_publisher"""
from ariadne_django.views import GraphQLView
from django.contrib import admin
from django.urls import path

from gentoo_build_publisher import views
from gentoo_build_publisher.graphql import schema

urlpatterns = [
    path("", views.dashboard),
    path("admin/", admin.site.urls),
    path("graphql", GraphQLView.as_view(schema=schema), name="graphql"),
]
예제 #5
0
def test_playground_html_is_served_on_get_request(request_factory, snapshot):
    view = GraphQLView.as_view()
    response = view(request_factory.get("/graphql/"))
    assert response.status_code == 200
    snapshot.assert_match(response.content)
예제 #6
0
def test_playground_options_can_be_set_on_view_init(request_factory, snapshot):
    view = GraphQLView.as_view(playground_options={"test.option": True})
    response = view(request_factory.get("/graphql/"))
    assert response.status_code == 200
    snapshot.assert_match(response.content)
예제 #7
0
    path("", include("hexa.core.urls", namespace="core")),
    path("user/", include("hexa.user_management.urls", namespace="user")),
    path("catalog/", include("hexa.catalog.urls", namespace="catalog")),
    path(
        "visualizations/",
        include("hexa.visualizations.urls", namespace="visualizations"),
    ),
    path("notebooks/", include("hexa.notebooks.urls", namespace="notebooks")),
    path("pipelines/", include("hexa.pipelines.urls", namespace="pipelines")),
    path("metrics/", include("hexa.metrics.urls", namespace="metrics")),
    path("comments/", include("hexa.comments.urls")),
    path("auth/", include("django.contrib.auth.urls")),
    path(
        "graphql/",
        GraphQLView.as_view(
            schema=schema,
            playground_options={"request.credentials": "include"})
        if settings.ENABLE_GRAPHQL is True else TemplateView.as_view(
            template_name="404.html"),
        name="graphql",
    ),
]

# Connector apps URLs
for app_config in get_connector_app_configs():
    urlpatterns.append(
        path(
            app_config.route_prefix + "/",
            include(app_config.name + ".urls", namespace=app_config.label),
        ))