Debian Codegraph @

examples/README.md

raw symbols SCIP
1 # Flasgger Examples
2
3 In this folder there is an example for each **Flasgger** functionality.
4
5 Each example on this folder represents a `test case` and is executed and validated when `make test` is executed.
6
7 This is the current testing running on `travis CI`
8
9 # Contributing
10
11 Please contribute adding your example to increase our test coverage
12
13 The only rules to follow is:
14
15 - Add extra production requirements to `requirements.txt` and `setup.py`
16 - Add extra development requirements to `requirements-dev.txt`
17 - use `if __name__ == '__main__':` before `app.run()`
18
19 # testing
20
21 You can also add extra tests to your example, just create a function called `test_swag` as:
22
23
24 ```python
25 def test_swag(client, specs_data):
26 """
27 This test is runs automatically in Travis CI
28
29 :param client: Flask app test client
30 :param specs_data: {'url': {swag_specs}} for every spec in app
31 """
32 for url, spec in specs_data.items():
33 assert 'Palette' in spec['definitions']
34 assert 'Color' in spec['definitions']
35 # 'route '/colors/<palette>/' becomes '/colors/{palette}/'
36 assert 'colors' in spec['paths']['/colors/{palette}/']['get']['tags']
37
38 ```
39