summaryrefslogtreecommitdiff
path: root/nova/tests/unit/integrated/api_samples/README.rst
blob: a08cac3a4292cc411e92ec5ade2717b9381c65ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Api Samples
===========

This part of the tree contains templates for API samples. The
documentation in doc/api_samples is completely autogenerated from the
tests in this directory.

To add a new api sample, add tests for the common passing and failing
cases in this directory for your extension, and modify test_samples.py
for your tests. There should be both JSON and XML tests included.

Then run the following command:

  GENERATE_SAMPLES=True tox -epy27 nova.tests.unit.integrated

Which will create the files on doc/api_samples.

If new tests are added or the .tpl files are changed due to bug fixes, the
samples must be regenerated so they are in sync with the templates, as
there is an additional test which reloads the documentation and
ensures that it's in sync.

Debugging sample generation
---------------------------

If a .tpl is changed, its matching .xml and .json must be removed
else the samples won't be generated. If an entirely new extension is
added, a directory for it must be created before its samples will
be generated.