You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
948 B

from django.core import management
from mock import patch, mock_open
from six import StringIO
def test_generate_file_on_call_graphql_schema(savefile_mock, settings):
out = StringIO()
management.call_command("graphql_schema", schema="", stdout=out)
assert "Successfully dumped GraphQL schema to schema.json" in out.getvalue()
def test_files_are_canonical(dump_mock):
open_mock = mock_open()
with patch("", open_mock):
management.call_command("graphql_schema", schema="")
assert dump_mock.call_args[1][
], "json.mock() should be used to sort the output"
assert (
dump_mock.call_args[1]["indent"] > 0
), "output should be pretty-printed by default"