8000 Updated tests · graphql-python/sanic-graphql@1948d12 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1948d12

Browse files
committed
Updated tests
1 parent 6085588 commit 1948d12

File tree

4 files changed

+188
-147
lines changed

4 files changed

+188
-147
lines changed

tests/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
def create_app(path='/graphql', **kwargs):
77
app = Sanic(__name__)
88
app.debug = True
9-
app.add_url_rule(path, view_func=GraphQLView.as_view('graphql', schema=Schema, **kwargs))
9+
app.add_route(GraphQLView.as_view(schema=Schema, **kwargs), path)
1010
return app
1111

12-
1312
if __name__ == '__main__':
1413
app = create_app(graphiql=True)
1514
app.run()

tests/test_graphiqlview.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import pytest
22

3-
from .app import create_app
4-
5-
6-
@pytest.fixture
7-
def app():
8-
return create_app(graphiql=True)
3+
from .util import app, client, url_string
94

105

116
def test_graphiql_is_enabled(client):
12-
response = client.get('/graphql', headers={'Accept': 'text/html'})
7+
response = client.get(app, uri='/graphql', headers={'Accept': 'text/html'})
138
assert response.status_code == 200
149

1510

1611
def test_graphiql_renders_pretty(client):
17-
response = client.get(url_for('graphql', query='{test}'), headers={'Accept': 'text/html'})
12+
response = client.get(app, uri=url_for('graphql', query='{test}'), headers={'Accept': 'text/html'})
1813
assert response.status_code == 200
1914
pretty_response = (
2015
'{\n'

0 commit comments

Comments
 (0)
0