File: README.md

package info (click to toggle)
python-flasgger 0.9.5%2Bdfsg.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,152 kB
  • sloc: javascript: 6,403; python: 3,665; makefile: 9; sh: 1
file content (39 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
36
37
38
39
# Flasgger Examples

In this folder there is an example for each **Flasgger** functionality.

Each example on this folder represents a `test case` and is executed and validated when `make test` is executed.

This is the current testing running on `travis CI`

# Contributing

Please contribute adding your example to increase our test coverage

The only rules to follow is:

- Add extra production requirements to `requirements.txt` and `setup.py`
- Add extra development requirements to `requirements-dev.txt`
- use `if __name__ == '__main__':` before `app.run()`

# testing

You can also add extra tests to your example, just create a function called `test_swag` as:


```python
def test_swag(client, specs_data):
    """
    This test is runs automatically in Travis CI

    :param client: Flask app test client
    :param specs_data: {'url': {swag_specs}} for every spec in app
    """
    for url, spec in specs_data.items():
        assert 'Palette' in spec['definitions']
        assert 'Color' in spec['definitions']
        # 'route '/colors/<palette>/' becomes '/colors/{palette}/'
        assert 'colors' in spec['paths']['/colors/{palette}/']['get']['tags']

```