-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a more explicit input_spec validation schema, with Cerberus
- Loading branch information
Showing
6 changed files
with
348 additions
and
224 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,29 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
tests.test_inpuc_spec | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
Tests on LaTeX-on-HTTP input spec. | ||
:copyright: (c) 2022 Yoan Tournade. | ||
:license: AGPL, see LICENSE for more details. | ||
""" | ||
import pytest | ||
import json | ||
import requests | ||
|
||
|
||
def test_input_spec_must_include_a_list_resources(latex_on_http_api_url): | ||
""" | ||
Compile a Latex document with a bibliography with biblatex. | ||
""" | ||
r = requests.post( | ||
latex_on_http_api_url + "/builds/sync", | ||
json={"resources": '{"main": true, "content": ""}'}, | ||
) | ||
assert r.status_code == 400 | ||
assert r.json() == { | ||
"error": "INVALID_PAYLOAD_SHAPE", | ||
"shape_errors": {"resources": ["must be of list type"]}, | ||
"input_spec_mode": "json", | ||
"input_spec": {"resources": '{"main": true, "content": ""}'}, | ||
} |
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