schemathesis 3.19.7__py3-none-any.whl → 3.20.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. schemathesis/_compat.py +3 -2
  2. schemathesis/_hypothesis.py +21 -6
  3. schemathesis/_xml.py +177 -0
  4. schemathesis/auths.py +48 -10
  5. schemathesis/cli/__init__.py +77 -19
  6. schemathesis/cli/callbacks.py +42 -18
  7. schemathesis/cli/context.py +2 -1
  8. schemathesis/cli/output/default.py +102 -34
  9. schemathesis/cli/sanitization.py +15 -0
  10. schemathesis/code_samples.py +141 -0
  11. schemathesis/constants.py +1 -24
  12. schemathesis/exceptions.py +127 -26
  13. schemathesis/experimental/__init__.py +85 -0
  14. schemathesis/extra/pytest_plugin.py +10 -4
  15. schemathesis/fixups/__init__.py +8 -2
  16. schemathesis/fixups/fast_api.py +11 -1
  17. schemathesis/fixups/utf8_bom.py +7 -1
  18. schemathesis/hooks.py +63 -0
  19. schemathesis/lazy.py +10 -4
  20. schemathesis/loaders.py +57 -0
  21. schemathesis/models.py +120 -96
  22. schemathesis/parameters.py +3 -0
  23. schemathesis/runner/__init__.py +3 -0
  24. schemathesis/runner/events.py +55 -20
  25. schemathesis/runner/impl/core.py +54 -54
  26. schemathesis/runner/serialization.py +75 -34
  27. schemathesis/sanitization.py +248 -0
  28. schemathesis/schemas.py +21 -6
  29. schemathesis/serializers.py +32 -3
  30. schemathesis/service/serialization.py +5 -1
  31. schemathesis/specs/graphql/loaders.py +44 -13
  32. schemathesis/specs/graphql/schemas.py +56 -25
  33. schemathesis/specs/openapi/_hypothesis.py +11 -23
  34. schemathesis/specs/openapi/definitions.py +572 -0
  35. schemathesis/specs/openapi/loaders.py +100 -49
  36. schemathesis/specs/openapi/parameters.py +2 -2
  37. schemathesis/specs/openapi/schemas.py +87 -13
  38. schemathesis/specs/openapi/security.py +1 -0
  39. schemathesis/stateful.py +2 -2
  40. schemathesis/utils.py +30 -9
  41. schemathesis-3.20.1.dist-info/METADATA +342 -0
  42. {schemathesis-3.19.7.dist-info → schemathesis-3.20.1.dist-info}/RECORD +45 -39
  43. schemathesis-3.19.7.dist-info/METADATA +0 -291
  44. {schemathesis-3.19.7.dist-info → schemathesis-3.20.1.dist-info}/WHEEL +0 -0
  45. {schemathesis-3.19.7.dist-info → schemathesis-3.20.1.dist-info}/entry_points.txt +0 -0
  46. {schemathesis-3.19.7.dist-info → schemathesis-3.20.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,291 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: schemathesis
3
- Version: 3.19.7
4
- Summary: Property-based testing framework for Open API and GraphQL based apps
5
- Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
6
- Project-URL: Changelog, https://schemathesis.readthedocs.io/en/stable/changelog.html
7
- Project-URL: Bug Tracker, https://github.com/schemathesis/schemathesis
8
- Project-URL: Funding, https://github.com/sponsors/Stranger6667
9
- Project-URL: Source Code, https://github.com/schemathesis/schemathesis
10
- Author-email: Dmitry Dygalo <dadygalo@gmail.com>
11
- Maintainer-email: Dmitry Dygalo <dadygalo@gmail.com>
12
- License-Expression: MIT
13
- License-File: LICENSE
14
- Keywords: graphql,hypothesis,openapi,pytest,swagger,testing
15
- Classifier: Development Status :: 5 - Production/Stable
16
- Classifier: Environment :: Console
17
- Classifier: Framework :: Hypothesis
18
- Classifier: Framework :: Pytest
19
- Classifier: Intended Audience :: Developers
20
- Classifier: License :: OSI Approved :: MIT License
21
- Classifier: Operating System :: OS Independent
22
- Classifier: Programming Language :: Python :: 3 :: Only
23
- Classifier: Programming Language :: Python :: 3.7
24
- Classifier: Programming Language :: Python :: 3.8
25
- Classifier: Programming Language :: Python :: 3.9
26
- Classifier: Programming Language :: Python :: 3.10
27
- Classifier: Programming Language :: Python :: 3.11
28
- Classifier: Programming Language :: Python :: Implementation :: CPython
29
- Classifier: Topic :: Software Development :: Testing
30
- Requires-Python: >=3.7
31
- Requires-Dist: backoff<3.0,>=2.1.2
32
- Requires-Dist: click<9.0,>=7.0
33
- Requires-Dist: colorama<1.0,>=0.4
34
- Requires-Dist: curlify<3.0,>=2.2.1
35
- Requires-Dist: httpx<1.0,>=0.22.0
36
- Requires-Dist: hypothesis-graphql<1,>=0.9.0
37
- Requires-Dist: hypothesis-jsonschema<1,>=0.22.1
38
- Requires-Dist: hypothesis<7,>=6.31.6
39
- Requires-Dist: importlib-metadata!=3.8,<5,>=1.1; python_version < '3.8'
40
- Requires-Dist: jsonschema<5.0,>=4.3.2
41
- Requires-Dist: junit-xml<2.0,>=1.9
42
- Requires-Dist: pyrate-limiter<3.0,>=2.10
43
- Requires-Dist: pytest-subtests<0.8.0,>=0.2.1
44
- Requires-Dist: pytest<8,>=4.6.4
45
- Requires-Dist: pyyaml<7.0,>=5.1
46
- Requires-Dist: requests<3,>=2.22
47
- Requires-Dist: starlette-testclient==0.2.0
48
- Requires-Dist: starlette<1,>=0.13
49
- Requires-Dist: tomli-w<2.0,>=1.0.0
50
- Requires-Dist: tomli<3.0,>=2.0.1
51
- Requires-Dist: typing-extensions<5,>=3.7
52
- Requires-Dist: werkzeug<=3,>=0.16.0
53
- Requires-Dist: yarl<2.0,>=1.5
54
- Provides-Extra: cov
55
- Requires-Dist: coverage-enable-subprocess; extra == 'cov'
56
- Requires-Dist: coverage[toml]>=5.3; extra == 'cov'
57
- Provides-Extra: dev
58
- Requires-Dist: schemathesis[cov,docs,tests]; extra == 'dev'
59
- Provides-Extra: docs
60
- Requires-Dist: sphinx; extra == 'docs'
61
- Provides-Extra: tests
62
- Requires-Dist: aiohttp<4.0,>=3.8.3; extra == 'tests'
63
- Requires-Dist: coverage>=6; extra == 'tests'
64
- Requires-Dist: fastapi>=0.86.0; extra == 'tests'
65
- Requires-Dist: flask<3.0,>=2.1.1; extra == 'tests'
66
- Requires-Dist: pydantic>=1.10.2; extra == 'tests'
67
- Requires-Dist: pytest-asyncio<1.0,>=0.18.0; extra == 'tests'
68
- Requires-Dist: pytest-httpserver<2.0,>=1.0; extra == 'tests'
69
- Requires-Dist: pytest-mock<4.0,>=3.7.0; extra == 'tests'
70
- Requires-Dist: pytest-xdist<4.0,>=3; extra == 'tests'
71
- Requires-Dist: strawberry-graphql[fastapi]>=0.109.0; extra == 'tests'
72
- Requires-Dist: trustme<1.0,>=0.9.0; extra == 'tests'
73
- Description-Content-Type: text/markdown
74
-
75
- <p align="center">
76
- <em>Discover API-breaking payloads, keep API documentation up-to-date, and increase confidence in your API</em>
77
- </p>
78
-
79
- <p align="center">
80
- <a href="https://github.com/schemathesis/schemathesis/actions" target="_blank">
81
- <img src="https://github.com/schemathesis/schemathesis/actions/workflows/build.yml/badge.svg" alt="Build">
82
- </a>
83
- <a href="https://codecov.io/gh/schemathesis/schemathesis/branch/master" target="_blank">
84
- <img src="https://codecov.io/gh/schemathesis/schemathesis/branch/master/graph/badge.svg" alt="Coverage">
85
- </a>
86
- <a href="https://pypi.org/project/schemathesis/" target="_blank">
87
- <img src="https://img.shields.io/pypi/v/schemathesis.svg" alt="Version">
88
- </a>
89
- <a href="https://pypi.org/project/schemathesis/" target="_blank">
90
- <img src="https://img.shields.io/pypi/pyversions/schemathesis.svg" alt="Python versions">
91
- </a>
92
- <a href="https://discord.gg/R9ASRAmHnA" target="_blank">
93
- <img src="https://img.shields.io/discord/938139740912369755" alt="Discord">
94
- </a>
95
- <a href="https://opensource.org/licenses/MIT" target="_blank">
96
- <img src="https://img.shields.io/pypi/l/schemathesis.svg" alt="License">
97
- </a>
98
- </p>
99
-
100
- ---
101
-
102
- **Documentation**: <a href="https://schemathesis.readthedocs.io/en/stable/" target="_blank">https://schemathesis.readthedocs.io/en/stable/ </a>
103
-
104
- **Chat**: <a href="https://discord.gg/R9ASRAmHnA" target="_blank">https://discord.gg/R9ASRAmHnA </a>
105
-
106
- ---
107
-
108
- Schemathesis is a specification-based testing tool for OpenAPI and GraphQL apps based on the powerful <a href="https://hypothesis.works/" target="_blank">Hypothesis</a> framework.
109
-
110
- Here are the key features:
111
-
112
- - **OpenAPI & GraphQL**: Test a wide range of APIs with ease, regardless of the specification used.
113
- - **Positive & Negative Tests**: Ensure your API handles valid and invalid inputs, incl. unexpected ones.
114
- - **Stateful Testing**: Automatically generate sequences of API
115
- requests where subsequent requests build on previous ones for
116
- testing complex and interdependent scenarios.
117
- - **Session Replay**: Quickly store and replay test sessions to easily investigate and resolve issues.
118
- - **Targeted Testing**: Guide data generation towards specific metrics
119
- like response time or size. Uncover performance or resource usage
120
- issues and optimize API behavior under different conditions.
121
- - **Python Integration**: Utilize native ASGI/WSGI support for faster testing your Python applications.
122
- - **Customization**: Tune data generation, API response verification, and testing process to fit your needs.
123
- - **CI Integration**: Run tests on every code change with Docker image
124
- and [GitHub Action](https://github.com/schemathesis/action).
125
- - **SaaS Platform**: Leverage an all-in-one solution with no setup or installation required.
126
- - **Commercial Support**: Benefit from prompt, professional guidance to maintain an optimal testing workflow.
127
-
128
- ## Testimonials
129
-
130
- "_The world needs modern, spec-based API tests, so we can deliver APIs as-designed. Schemathesis is the right tool for that job._"
131
-
132
- <div>Emmanuel Paraskakis - <strong>Level 250</strong></div>
133
-
134
- ---
135
-
136
- "_Schemathesis is the only sane way to thoroughly test an API._"
137
-
138
- <div>Zdenek Nemec - <strong>superface.ai</strong></div>
139
-
140
- ---
141
-
142
- "_The tool is absolutely amazing as it can do the negative scenario testing instead of me and much faster! Before I was doing the same tests in Postman client. But it's much slower and brings maintenance burden._"
143
-
144
- <div>Luděk Nový - <strong>JetBrains</strong></div>
145
-
146
- ---
147
-
148
- "_Schemathesis is the best tool for fuzz testing of REST API on the market. We are at Red Hat use it for examining our applications in functional and integrations testing levels._"
149
-
150
- <div>Dmitry Misharov - <strong>RedHat</strong></div>
151
-
152
- ---
153
-
154
- ## How does it work?
155
-
156
- Schemathesis uses your API's schema to generate both valid and invalid
157
- test scenarios, helping you verify API compliance and catch potential
158
- issues. It also verifies examples from the schema itself.
159
-
160
- Schemathesis generates high quality, diverse test data based on novel
161
- techniques like [Swarm
162
- testing](https://dl.acm.org/doi/10.1145/2338965.2336763) or [Schema
163
- fuzzing](https://patricegodefroid.github.io/public_psfiles/fse2020.pdf),
164
- ensuring that your API is thoroughly tested and even the most elusive
165
- bugs are uncovered.
166
-
167
- It's a versatile tool that works with any language, as long as you have
168
- an API schema in a supported format.
169
-
170
- Learn more about how it works in our [research
171
- paper](https://arxiv.org/abs/2112.10328).
172
-
173
- ## Why use Schemathesis?
174
-
175
- 1. **Avoid Crashes**: Discover API-breaking payloads and avoid crashes, database corruption, and hangs.
176
- 2. **Keep API Documentation Up-to-Date**: With Schemathesis, you never have to worry about API consumers using outdated specifications or incorrect payload examples.
177
- 3. **Easy Debugging**: Schemathesis provides you with a detailed failure report, along with a single cURL command to help you reproduce the problem instantly.
178
- 4. **Increased Confidence in API Stability**: By thoroughly testing your API with Schemathesis, you can have peace of mind knowing that your API is functioning as intended.
179
- 5. **Thorough Testing Coverage**: Schemathesis generates a large number of scenarios to test your API against, giving you a comprehensive view of its behavior and potential issues.
180
- 6. **Time-Saving**: Schemathesis streamlines API testing, saving your time for other tasks.
181
-
182
- ## Getting started
183
-
184
- Schemathesis can be used as a CLI, a Python library, a [GitHub app](https://github.com/apps/schemathesis), or as a [SaaS](https://schemathesis.io/?utm_source=github).
185
-
186
- - **CLI**: Quick and easy way to get started, for those who prefer the command line.
187
- - **Python Library**: More control and customization, for developers integrating with their codebase.
188
- - **GitHub App**: Direct testing in your GitHub repositories with reports in your pull requests.
189
- - **SaaS**: No setup or installation, if you prefer an all-in-one solution with great visuals. Free tier included.
190
-
191
- ## Installation
192
-
193
- ```bash
194
- python -m pip install schemathesis
195
- ```
196
-
197
- This command installs the `st` entrypoint.
198
-
199
- You can also use our Docker image without installing Schemathesis as a Python package:
200
-
201
- ```bash
202
- docker pull schemathesis/schemathesis:stable
203
- ```
204
-
205
- If you use GitHub, there is a native [GitHub app](https://github.com/apps/schemathesis) that reports test results directly to your pull requests.
206
-
207
- ## Example
208
-
209
- ### GitHub Actions
210
-
211
- ```yaml
212
- api-tests:
213
- runs-on: ubuntu-20.04
214
- steps:
215
- # Runs Schemathesis tests with all checks enabled
216
- - uses: schemathesis/action@v1
217
- with:
218
- # Your API schema location
219
- schema: "http://localhost:5000/api/openapi.json"
220
- # OPTIONAL. Your Schemathesis.io token
221
- token: ${{ secrets.SCHEMATHESIS_TOKEN }}
222
- ```
223
-
224
- Check our [GitHub Action](https://github.com/schemathesis/action) for more details.
225
-
226
- ### Command line
227
-
228
- ```bash
229
- st run --checks all https://example.schemathesis.io/openapi.json
230
-
231
- # Or
232
-
233
- docker run schemathesis/schemathesis:stable \
234
- run --checks all https://example.schemathesis.io/openapi.json
235
- ```
236
-
237
- ![image](https://raw.githubusercontent.com/schemathesis/schemathesis/master/img/demo.gif)
238
-
239
- ### Python tests
240
-
241
- ```python
242
- import schemathesis
243
-
244
- schema = schemathesis.from_uri("https://example.schemathesis.io/openapi.json")
245
-
246
-
247
- @schema.parametrize()
248
- def test_api(case):
249
- case.call_and_validate()
250
- ```
251
-
252
- Choose CLI for simplicity or Python package for greater flexibility. Both options run extensive tests and report failures with reproduction instructions.
253
-
254
- 💡 See a complete working example project in the [/example](https://github.com/schemathesis/schemathesis/tree/master/example) directory.💡
255
-
256
- ## Let's make it better together 🤝
257
-
258
- We're always looking to make Schemathesis better, and your feedback is
259
- a crucial part of that journey! If you've got a few minutes, we'd love
260
- to hear your thoughts on your experience using Schemathesis.
261
-
262
- Just follow [this link](https://forms.gle/kJ4hSxc1Yp6Ga96t5) to let us know what you think 💬
263
-
264
- Thanks for helping us make Schemathesis even better! 👍
265
-
266
- ## Commercial support
267
-
268
- For assistance with integrating Schemathesis into your company workflows or improving its effectiveness, reach out to our support team at <a href="mailto:support@schemathesis.io">support@schemathesis.io</a>.
269
- Additionally, we offer commercial support for those looking for extra assurance and priority assistance.
270
-
271
- ## Contributing
272
-
273
- Any contribution to development, testing, or any other area is highly
274
- appreciated and useful to the project. For guidance on how to contribute
275
- to Schemathesis, see the [contributing guidelines](https://github.com/schemathesis/schemathesis/blob/master/CONTRIBUTING.rst).
276
-
277
- ## Additional content
278
-
279
- - [Deriving Semantics-Aware Fuzzers from Web API Schemas](https://arxiv.org/abs/2112.10328) by **@Zac-HD** and **@Stranger6667**
280
- - [An article](https://dygalo.dev/blog/schemathesis-property-based-testing-for-api-schemas/) about Schemathesis by **@Stranger6667**
281
- - [Effective API schemas testing](https://youtu.be/VVLZ25JgjD4) from DevConf.cz by **@Stranger6667**
282
- - [How to use Schemathesis to test Flask API in GitHub Actions](https://notes.lina-is-here.com/2022/08/04/schemathesis-docker-compose.html) by **@lina-is-here**
283
- - [Testing APIFlask with schemathesis](http://blog.pamelafox.org/2023/02/testing-apiflask-with-schemathesis.html) by **@pamelafox**
284
- - [A video](https://www.youtube.com/watch?v=9FHRwrv-xuQ) from EuroPython 2020 by **@hultner**
285
- - [Schemathesis tutorial](https://appdev.consulting.redhat.com/tracks/contract-first/automated-testing-with-schemathesis.html) with an accompanying [video](https://www.youtube.com/watch?v=4r7OC-lBKMg) by Red Hat
286
- - [Using Hypothesis and Schemathesis to Test FastAPI](https://testdriven.io/blog/fastapi-hypothesis/) by **@amalshaji**
287
- - [A tutorial](https://habr.com/ru/company/oleg-bunin/blog/576496/) (RUS) about Schemathesis by **@Stranger6667**
288
-
289
- ## License
290
-
291
- This project is licensed under the terms of the [MIT license](https://opensource.org/licenses/MIT).