js-api: Add hooks to run tests and render docs of JS API examples.

This commit adds python code to call javascript_examples.js in its
two supported modes. tools/test-api asserts that the example output
is as expected, whereas the API markdown extension is used to render
these examples in the docs.
This commit is contained in:
Rohitt Vashishtha
2020-05-17 10:04:53 +00:00
committed by Tim Abbott
parent 642d1a20d0
commit 6dd4030e67
3 changed files with 73 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ with test_server_running(force=options.force, external_host='zulipdev.com:9981')
# Zerver imports should happen after `django.setup()` is run
# by the test_server_running decorator.
from zerver.openapi.python_examples import test_the_api, test_invalid_api_key
from zerver.openapi.javascript_examples import test_js_bindings
from zerver.openapi.test_curl_examples import test_generated_curl_examples_for_success
from zerver.lib.actions import do_create_user
from zerver.lib.test_helpers import reset_emails_in_zulip_realm
@@ -77,6 +78,7 @@ with test_server_running(force=options.force, external_host='zulipdev.com:9981')
test_the_api(client, nonadmin_client)
test_generated_curl_examples_for_success(client)
test_js_bindings(client)
# Test error payloads
client = Client(