schemathesis 4.0.0a6__py3-none-any.whl → 4.0.0a7__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.
- schemathesis/cli/commands/run/__init__.py +12 -0
- schemathesis/cli/commands/run/validation.py +8 -0
- schemathesis/generation/__init__.py +1 -0
- schemathesis/generation/hypothesis/builder.py +14 -4
- {schemathesis-4.0.0a6.dist-info → schemathesis-4.0.0a7.dist-info}/METADATA +1 -1
- {schemathesis-4.0.0a6.dist-info → schemathesis-4.0.0a7.dist-info}/RECORD +9 -9
- {schemathesis-4.0.0a6.dist-info → schemathesis-4.0.0a7.dist-info}/WHEEL +0 -0
- {schemathesis-4.0.0a6.dist-info → schemathesis-4.0.0a7.dist-info}/entry_points.txt +0 -0
- {schemathesis-4.0.0a6.dist-info → schemathesis-4.0.0a7.dist-info}/licenses/LICENSE +0 -0
@@ -305,6 +305,16 @@ DEFAULT_PHASES = ("examples", "coverage", "fuzzing", "stateful")
|
|
305
305
|
multiple=True,
|
306
306
|
metavar="FEATURES",
|
307
307
|
)
|
308
|
+
@grouped_option(
|
309
|
+
"--experimental-coverage-unexpected-methods",
|
310
|
+
"coverage_unexpected_methods",
|
311
|
+
help="HTTP methods to use when generating test cases with methods not specified in the API during the coverage phase.",
|
312
|
+
type=CsvChoice(["get", "put", "post", "delete", "options", "head", "patch", "trace"], case_sensitive=False),
|
313
|
+
callback=validation.convert_http_methods,
|
314
|
+
metavar="",
|
315
|
+
default=None,
|
316
|
+
envvar="SCHEMATHESIS_EXPERIMENTAL_COVERAGE_UNEXPECTED_METHODS",
|
317
|
+
)
|
308
318
|
@grouped_option(
|
309
319
|
"--experimental-missing-required-header-allowed-statuses",
|
310
320
|
"missing_required_header_allowed_statuses",
|
@@ -489,6 +499,7 @@ def run(
|
|
489
499
|
set_cookie: dict[str, str],
|
490
500
|
set_path: dict[str, str],
|
491
501
|
experiments: list,
|
502
|
+
coverage_unexpected_methods: set[str] | None,
|
492
503
|
missing_required_header_allowed_statuses: list[str],
|
493
504
|
positive_data_acceptance_allowed_statuses: list[str],
|
494
505
|
negative_data_rejection_allowed_statuses: list[str],
|
@@ -655,6 +666,7 @@ def run(
|
|
655
666
|
graphql_allow_null=generation_graphql_allow_null,
|
656
667
|
codec=generation_codec,
|
657
668
|
with_security_parameters=generation_with_security_parameters,
|
669
|
+
unexpected_methods=coverage_unexpected_methods,
|
658
670
|
),
|
659
671
|
max_failures=max_failures,
|
660
672
|
continue_on_failure=continue_on_failure,
|
@@ -270,6 +270,14 @@ def reduce_list(ctx: click.core.Context, param: click.core.Parameter, value: tup
|
|
270
270
|
return reduce(operator.iadd, value, [])
|
271
271
|
|
272
272
|
|
273
|
+
def convert_http_methods(
|
274
|
+
ctx: click.core.Context, param: click.core.Parameter, value: list[str] | None
|
275
|
+
) -> set[str] | None:
|
276
|
+
if value is None:
|
277
|
+
return value
|
278
|
+
return {item.lower() for item in value}
|
279
|
+
|
280
|
+
|
273
281
|
def convert_status_codes(
|
274
282
|
ctx: click.core.Context, param: click.core.Parameter, value: list[str] | None
|
275
283
|
) -> list[str] | None:
|
@@ -128,7 +128,12 @@ def create_test(
|
|
128
128
|
and not config.given_kwargs
|
129
129
|
):
|
130
130
|
hypothesis_test = add_coverage(
|
131
|
-
hypothesis_test,
|
131
|
+
hypothesis_test,
|
132
|
+
operation,
|
133
|
+
config.generation.modes,
|
134
|
+
auth_storage,
|
135
|
+
config.as_strategy_kwargs,
|
136
|
+
config.generation.unexpected_methods,
|
132
137
|
)
|
133
138
|
|
134
139
|
setattr(hypothesis_test, SETTINGS_ATTRIBUTE_NAME, settings)
|
@@ -215,6 +220,7 @@ def add_coverage(
|
|
215
220
|
generation_modes: list[GenerationMode],
|
216
221
|
auth_storage: AuthStorage | None,
|
217
222
|
as_strategy_kwargs: dict[str, Any],
|
223
|
+
unexpected_methods: set[str] | None = None,
|
218
224
|
) -> Callable:
|
219
225
|
from schemathesis.specs.openapi.constants import LOCATION_TO_CONTAINER
|
220
226
|
|
@@ -227,7 +233,7 @@ def add_coverage(
|
|
227
233
|
for container in LOCATION_TO_CONTAINER.values()
|
228
234
|
if container in as_strategy_kwargs
|
229
235
|
}
|
230
|
-
for case in _iter_coverage_cases(operation, generation_modes):
|
236
|
+
for case in _iter_coverage_cases(operation, generation_modes, unexpected_methods):
|
231
237
|
if case.media_type and operation.schema.transport.get_first_matching_media_type(case.media_type) is None:
|
232
238
|
continue
|
233
239
|
adjust_urlencoded_payload(case)
|
@@ -362,7 +368,9 @@ def _stringify_value(val: Any, container_name: str) -> Any:
|
|
362
368
|
|
363
369
|
|
364
370
|
def _iter_coverage_cases(
|
365
|
-
operation: APIOperation,
|
371
|
+
operation: APIOperation,
|
372
|
+
generation_modes: list[GenerationMode],
|
373
|
+
unexpected_methods: set[str] | None = None,
|
366
374
|
) -> Generator[Case, None, None]:
|
367
375
|
from schemathesis.specs.openapi.constants import LOCATION_TO_CONTAINER
|
368
376
|
from schemathesis.specs.openapi.examples import find_in_responses, find_matching_in_responses
|
@@ -374,6 +382,8 @@ def _iter_coverage_cases(
|
|
374
382
|
|
375
383
|
instant = Instant()
|
376
384
|
responses = find_in_responses(operation)
|
385
|
+
# NOTE: The HEAD method is excluded
|
386
|
+
unexpected_methods = unexpected_methods or {"get", "put", "post", "delete", "options", "patch", "trace"}
|
377
387
|
for parameter in operation.iter_parameters():
|
378
388
|
location = parameter.location
|
379
389
|
name = parameter.name
|
@@ -488,7 +498,7 @@ def _iter_coverage_cases(
|
|
488
498
|
)
|
489
499
|
if GenerationMode.NEGATIVE in generation_modes:
|
490
500
|
# Generate HTTP methods that are not specified in the spec
|
491
|
-
methods =
|
501
|
+
methods = unexpected_methods - set(operation.schema[operation.path])
|
492
502
|
for method in sorted(methods):
|
493
503
|
instant = Instant()
|
494
504
|
data = template.unmodified()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: schemathesis
|
3
|
-
Version: 4.0.
|
3
|
+
Version: 4.0.0a7
|
4
4
|
Summary: Property-based testing framework for Open API and GraphQL based apps
|
5
5
|
Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
|
6
6
|
Project-URL: Changelog, https://schemathesis.readthedocs.io/en/stable/changelog.html
|
@@ -12,7 +12,7 @@ schemathesis/cli/constants.py,sha256=rUixnqorraUFDtOu3Nmm1x_k0qbgmW9xW96kQB_fBCQ
|
|
12
12
|
schemathesis/cli/core.py,sha256=Qm5xvpIIMwJDTeR3N3TjKhMCHV5d5Rp0UstVS2GjWgw,459
|
13
13
|
schemathesis/cli/hooks.py,sha256=vTrA8EN99whRns5K5AnExViQ6WL9cak5RGsC-ZBEiJM,1458
|
14
14
|
schemathesis/cli/commands/__init__.py,sha256=FFalEss3D7mnCRO0udtYb65onXSjQCCOv8sOSjqvTTM,1059
|
15
|
-
schemathesis/cli/commands/run/__init__.py,sha256=
|
15
|
+
schemathesis/cli/commands/run/__init__.py,sha256=ACIRF3eP-Za56sY5OMSdLdbrmopPvJblDel4Jl-vBtw,23745
|
16
16
|
schemathesis/cli/commands/run/checks.py,sha256=lLtBCt6NhhQisrWo8aC6i0M3dSXlbjGWTTlOyjzatks,3278
|
17
17
|
schemathesis/cli/commands/run/context.py,sha256=pUwSlS7UwW2cq1nJXfKZFEaWDipsQAElCO4tdv1qYJA,7739
|
18
18
|
schemathesis/cli/commands/run/events.py,sha256=Dj-xvIr-Hkms8kvh4whNwKSk1Q2Hx4NIENi_4A8nQO8,1224
|
@@ -21,7 +21,7 @@ schemathesis/cli/commands/run/filters.py,sha256=MdymOZtzOolvXCNBIdfHbBbWEXVF7Se0
|
|
21
21
|
schemathesis/cli/commands/run/hypothesis.py,sha256=hdEHim_Hc2HwCGxAiRTf4t2OfQf0IeCUhyjNT_btB1o,2553
|
22
22
|
schemathesis/cli/commands/run/loaders.py,sha256=VedoeIE1tgFBqVokWxOoUReAjBl-Zhx87RjCEBtCVfs,4840
|
23
23
|
schemathesis/cli/commands/run/reports.py,sha256=OjyakiV0lpNDBZb1xsb_2HmLtcqhTThPYMpJGXyNNO8,2147
|
24
|
-
schemathesis/cli/commands/run/validation.py,sha256=
|
24
|
+
schemathesis/cli/commands/run/validation.py,sha256=cpGG5hFc4lHVemXrQXRvrlNlqBmMqtvx9yUwbOhc2TI,13008
|
25
25
|
schemathesis/cli/commands/run/handlers/__init__.py,sha256=TPZ3KdGi8m0fjlN0GjA31MAXXn1qI7uU4FtiDwroXZI,1915
|
26
26
|
schemathesis/cli/commands/run/handlers/base.py,sha256=yDsTtCiztLksfk7cRzg8JlaAVOfS-zwK3tsJMOXAFyc,530
|
27
27
|
schemathesis/cli/commands/run/handlers/cassettes.py,sha256=SVk13xPhsQduCpgvvBwzEMDNTju-SHQCW90xTQ6iL1U,18525
|
@@ -72,7 +72,7 @@ schemathesis/engine/phases/unit/__init__.py,sha256=LcBQpGNPeEFB9XPGpcHBcH-C7nF-e
|
|
72
72
|
schemathesis/engine/phases/unit/_executor.py,sha256=buMEr7e01SFSeNuEQNGMf4hoiLxX9_sp0JhH4LBAk9M,12928
|
73
73
|
schemathesis/engine/phases/unit/_pool.py,sha256=9OgmFd-ov1AAvcZGquK40PXkGLp7f2qCjZoPZuoZl4A,2529
|
74
74
|
schemathesis/experimental/__init__.py,sha256=jYY3Mq6okqTRTMudPzcaT0JVjzJW5IN_ZVJdGU0stBs,2011
|
75
|
-
schemathesis/generation/__init__.py,sha256=
|
75
|
+
schemathesis/generation/__init__.py,sha256=sWTRPTh-qDNkSfpM9rYI3v8zskH8_wFKUuPRg18fZI8,1627
|
76
76
|
schemathesis/generation/case.py,sha256=Rt5MCUtPVYVQzNyjUx8magocPJpHV1svyuqQSTwUE-I,7306
|
77
77
|
schemathesis/generation/coverage.py,sha256=hyDb465tBoCWE7nI-ZJjhTUzk7f2WDufaadWdSAkdr0,39276
|
78
78
|
schemathesis/generation/meta.py,sha256=36h6m4E7jzLGa8TCvl7eBl_xUWLiRul3qxzexl5cB58,2515
|
@@ -80,7 +80,7 @@ schemathesis/generation/modes.py,sha256=t_EvKr2aOXYMsEfdMu4lLF4KCGcX1LVVyvzTkcpJ
|
|
80
80
|
schemathesis/generation/overrides.py,sha256=FhqcFoliEvgW6MZyFPYemfLgzKt3Miy8Cud7OMOCb7g,3045
|
81
81
|
schemathesis/generation/targets.py,sha256=_rN2qgxTE2EfvygiN-Fy3WmDnRH0ERohdx3sKRDaYhU,2120
|
82
82
|
schemathesis/generation/hypothesis/__init__.py,sha256=Rl7QwvMBMJI7pBqTydplX6bXC420n0EGQHVm-vZgaYQ,1204
|
83
|
-
schemathesis/generation/hypothesis/builder.py,sha256=
|
83
|
+
schemathesis/generation/hypothesis/builder.py,sha256=6U4BaTx0VMVRXhmKrEakDSnHunIdEMQiBZfr89pdpP4,29618
|
84
84
|
schemathesis/generation/hypothesis/examples.py,sha256=6eGaKUEC3elmKsaqfKj1sLvM8EHc-PWT4NRBq4NI0Rs,1409
|
85
85
|
schemathesis/generation/hypothesis/given.py,sha256=sTZR1of6XaHAPWtHx2_WLlZ50M8D5Rjux0GmWkWjDq4,2337
|
86
86
|
schemathesis/generation/hypothesis/reporting.py,sha256=uDVow6Ya8YFkqQuOqRsjbzsbyP4KKfr3jA7ZaY4FuKY,279
|
@@ -146,8 +146,8 @@ schemathesis/transport/prepare.py,sha256=qQ6zXBw5NN2AIM0bzLAc5Ryc3dmMb0R6xN14lnR
|
|
146
146
|
schemathesis/transport/requests.py,sha256=j5wI1Uo_PnVuP1eV8l6ddsXosyxAPQ1mLSyWEZmTI9I,8747
|
147
147
|
schemathesis/transport/serialization.py,sha256=jIMra1LqRGav0OX3Hx7mvORt38ll4cd2DKit2D58FN0,10531
|
148
148
|
schemathesis/transport/wsgi.py,sha256=RWSuUXPrl91GxAy8a4jyNNozOWVMRBxKx_tljlWA_Lo,5697
|
149
|
-
schemathesis-4.0.
|
150
|
-
schemathesis-4.0.
|
151
|
-
schemathesis-4.0.
|
152
|
-
schemathesis-4.0.
|
153
|
-
schemathesis-4.0.
|
149
|
+
schemathesis-4.0.0a7.dist-info/METADATA,sha256=l_31cA1530vqN9M094EGpnFezX2Sk-YyJDq8_pSWcro,10427
|
150
|
+
schemathesis-4.0.0a7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
151
|
+
schemathesis-4.0.0a7.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
|
152
|
+
schemathesis-4.0.0a7.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
|
153
|
+
schemathesis-4.0.0a7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|