Skip to content

Commit 43dede4

Browse files
committed
Add a test for parse error output (coverage)
1 parent b82e808 commit 43dede4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

end_to_end_tests/invalid_openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
openapi:
2+
info:
3+
title: "I don't have a version"

end_to_end_tests/test_end_to_end.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ def test_bad_url():
222222
assert "Could not get OpenAPI document from provided URL" in result.stdout
223223

224224

225+
def test_invalid_document():
226+
runner = CliRunner()
227+
result = runner.invoke(app, ["generate", "--path=end_to_end_tests/invalid_openapi.yaml"])
228+
assert result.exit_code == 1
229+
assert "Failed to parse OpenAPI document" in result.stdout
230+
231+
225232
def test_custom_post_hooks():
226233
shutil.rmtree(Path.cwd() / "my-test-api-client", ignore_errors=True)
227234
runner = CliRunner()

0 commit comments

Comments
 (0)