Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add more tests for GraphQL view

Marcin Gębala6688147e0fe1
diff --git a/tests/api/test_view.py b/tests/api/test_view.py
index f48b14a22c..930bbdbe3a 100644
--- a/tests/api/test_view.py
+++ b/tests/api/test_view.py
@@ -1,5 +1,7 @@
import graphene
+import pytest
+from .conftest import API_PATH
from .utils import get_graphql_content
@@ -35,3 +37,21 @@ def test_batch_queries(category, product, staff_api_client):
for field, value in content['data'].items()}
assert data['product']['name'] == product.name
assert data['category']['name'] == category.name
+
+
+def test_graphql_view_get(client):
+ response = client.get(API_PATH)
+ assert response.status_code == 200
+ assert response.templates[0].name == 'graphql/playground.html'
+
+
+def test_graphql_view_options(client):
+ response = client.options(API_PATH)
+ assert response.status_code == 200
+
+
[email protected]('method', ('put', 'patch', 'delete'))
+def test_graphql_view_not_allowed(method, client):
+ func = getattr(client, method)
+ response = func(API_PATH)
+ assert response.status_code == 405