-
-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add a basic test to see if graphql template is rendering - Add test for the failed rendering of the setting when overriding the template
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script>JSON.parse("{{ SUBSCRIPTION_ENABLED }}")</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from pathlib import Path | ||
|
||
from django.http import HttpResponse | ||
from django.test import Client, override_settings | ||
|
||
BASE_DIR = Path(__file__).parent | ||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [BASE_DIR / "templates"], | ||
"APP_DIRS": True, | ||
} | ||
] | ||
|
||
|
||
def test_render_graphiql_template(): | ||
headers = { | ||
"Accept": "text/html", | ||
} | ||
client = Client(headers=headers) | ||
response: HttpResponse = client.get("/graphql/") | ||
assert 'JSON.parse("false")' in response.content.decode() | ||
|
||
|
||
@override_settings(TEMPLATES=TEMPLATES) | ||
def test_subscription_enabled_not_empty(): | ||
headers = { | ||
"Accept": "text/html", | ||
} | ||
client = Client(headers=headers) | ||
response: HttpResponse = client.get("/graphql/") | ||
assert 'JSON.parse("false")' in response.content.decode() |