Beispiel #1
0
async def test_graphiql_get_mutation(app, client):
    response = await client.get(
        url_string(query="mutation TestMutation { writeTest { test } }"),
        headers={"Accept": "text/html"},
    )
    assert response.status == 200
    assert "response: null" in await response.text()
Beispiel #2
0
async def test_graphiql_simple_renderer(app, client, pretty_response):
    response = await client.get(
        url_string(query="{test}"),
        headers={"Accept": "text/html"},
    )
    assert response.status == 200
    assert pretty_response in await response.text()
async def test_graphiql_get_subscriptions(app, client):
    response = await client.get(
        url_string(
            query=
            "subscription TestSubscriptions { subscriptionsTest { test } }"),
        headers={"Accept": "text/html"},
    )
    assert response.status == 200
    assert "response: null" in await response.text()
async def test_graphiql_enabled_sync_schema(app, client):
    response = await client.get(
        url_string(query="{a,b}"),
        headers={"Accept": "text/html"},
    )

    expected_response = (("{\n"
                          '  "data": {\n'
                          '    "a": "synced_one",\n'
                          '    "b": "synced_two"\n'
                          "  }\n"
                          "}").replace('"', '\\"').replace("\n", "\\n"))
    assert response.status == 200
    assert expected_response in await response.text()
Beispiel #5
0
async def test_graphiql_async_schema(app, client):
    response = await client.get(
        url_string(query="{a,b,c}"),
        headers={"Accept": "text/html"},
    )

    assert response.status == 200
    assert await response.json() == {
        "data": {
            "a": "hey",
            "b": "hey2",
            "c": "hey3"
        }
    }
async def test_graphiql_is_enabled(app, client):
    response = await client.get(url_string(query="{test}"),
                                headers={"Accept": "text/html"})
    assert response.status == 200