Skip to content

Commit

Permalink
chore: add short command test
Browse files Browse the repository at this point in the history
  • Loading branch information
stillmatic committed Aug 14, 2023
1 parent d0dfa3d commit 74a74ec
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions tests/cli/test_export_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,20 @@ def test_invalid_schema_instance(cli_app: Typer, cli_runner: CliRunner):
def test_output_option(cli_app: Typer, cli_runner: CliRunner, tmp_path):
selector = "tests.fixtures.sample_package.sample_module:schema"
output = tmp_path / "schema.graphql"
result = cli_runner.invoke(
cli_app, ["export-schema", selector, "--output", str(output)]
)

assert result.exit_code == 0
assert output.read_text() == (
"type Query {\n"
" user: User!\n"
"}\n"
"\n"
"type User {\n"
" name: String!\n"
" age: Int!\n"
"}"
)
output_commands = ["--output", "-o"]
for output_command in output_commands:
result = cli_runner.invoke(
cli_app, ["export-schema", selector, output_command, str(output)]
)

assert result.exit_code == 0
assert output.read_text() == (
"type Query {\n"
" user: User!\n"
"}\n"
"\n"
"type User {\n"
" name: String!\n"
" age: Int!\n"
"}"
)

0 comments on commit 74a74ec

Please sign in to comment.