mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
Make schema also be pretty-printed by default for easier diffs.
This commit is contained in:
parent
1ca44b55cb
commit
6c1a301423
|
@ -28,7 +28,7 @@ except ImportError:
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
"SCHEMA": None,
|
"SCHEMA": None,
|
||||||
"SCHEMA_OUTPUT": "schema.json",
|
"SCHEMA_OUTPUT": "schema.json",
|
||||||
"SCHEMA_INDENT": None,
|
"SCHEMA_INDENT": 2,
|
||||||
"MIDDLEWARE": (),
|
"MIDDLEWARE": (),
|
||||||
# Set to True if the connection fields must have
|
# Set to True if the connection fields must have
|
||||||
# either the first or last argument
|
# either the first or last argument
|
||||||
|
|
|
@ -11,7 +11,7 @@ def test_generate_file_on_call_graphql_schema(savefile_mock, settings):
|
||||||
|
|
||||||
|
|
||||||
@patch('json.dump')
|
@patch('json.dump')
|
||||||
def test_files_are_sorted(dump_mock):
|
def test_files_are_canonical(dump_mock):
|
||||||
open_mock = mock_open()
|
open_mock = mock_open()
|
||||||
with patch('graphene_django.management.commands.graphql_schema.open', open_mock):
|
with patch('graphene_django.management.commands.graphql_schema.open', open_mock):
|
||||||
management.call_command('graphql_schema', schema='')
|
management.call_command('graphql_schema', schema='')
|
||||||
|
@ -20,3 +20,4 @@ def test_files_are_sorted(dump_mock):
|
||||||
|
|
||||||
dump_mock.assert_called_once()
|
dump_mock.assert_called_once()
|
||||||
assert dump_mock.call_args[1]["sort_keys"], "json.mock() should be used to sort the output"
|
assert dump_mock.call_args[1]["sort_keys"], "json.mock() should be used to sort the output"
|
||||||
|
assert dump_mock.call_args[1]["indent"] > 0, "output should be pretty-printed by default"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user