Skip to content

Commit

Permalink
chore: Loaders unification
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Apr 2, 2021
1 parent 36c0c87 commit a2d9beb
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 63 deletions.
17 changes: 17 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ Changelog
- Support for ``data_generation_methods`` and ``code_sample_style`` in all GraphQL loaders.
- Support for ``app`` & ``base_url`` arguments for the ``from_pytest_fixture`` runner.

**Breaking**

- Loaders' signatures are unified. Most of the arguments became keyword-only. All except the first two for ASGI/WSGI, all except the first one for the others.
It forces loader calls to be more consistent.

.. code-block:: python
# BEFORE
schema = schemathesis.from_uri(
"http://example.com/openapi.json", "http://127.0.0.1:8000/", "GET"
)
# NOW
schema = schemathesis.from_uri(
"http://example.com/openapi.json", base_url="http://127.0.0.1:8000/", method="GET"
)
**Changed**

- Schemathesis generates separate tests for each field defined in the GraphQL ``Query`` type. It makes the testing process
Expand All @@ -29,6 +45,7 @@ Changelog
- Silently ignoring some incorrect usages of ``@schema.given``.
- Fixups examples were using incorrect fixup name.
- Return type of ``make_case`` for GraphQL schemas.
- Missed ``operation_id`` argument in ``from_asgi`` loader.

`3.5.3`_ - 2021-03-27
---------------------
Expand Down
12 changes: 7 additions & 5 deletions src/schemathesis/specs/graphql/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@

def from_url(
url: str,
base_url: Optional[str] = None,
port: Optional[int] = None,
*,
app: Any = None,
base_url: Optional[str] = None,
port: Optional[int] = None,
data_generation_methods: Iterable[DataGenerationMethod] = DEFAULT_DATA_GENERATION_METHODS,
code_sample_style: str = CodeSampleStyle.default().name,
**kwargs: Any,
Expand Down Expand Up @@ -135,12 +135,12 @@ def from_url(

def from_dict(
raw_schema: Dict[str, Any],
location: Optional[str] = None,
base_url: Optional[str] = None,
*,
app: Any = None,
base_url: Optional[str] = None,
location: Optional[str] = None,
data_generation_methods: Iterable[DataGenerationMethod] = DEFAULT_DATA_GENERATION_METHODS,
code_sample_style: str = CodeSampleStyle.default().name,
app: Any = None,
) -> GraphQLSchema:
"""Load GraphQL schema from a Python dictionary.
Expand All @@ -158,6 +158,7 @@ def from_dict(
def from_wsgi(
schema_path: str,
app: Any,
*,
base_url: Optional[str] = None,
data_generation_methods: Iterable[DataGenerationMethod] = DEFAULT_DATA_GENERATION_METHODS,
code_sample_style: str = CodeSampleStyle.default().name,
Expand Down Expand Up @@ -189,6 +190,7 @@ def from_wsgi(
def from_asgi(
schema_path: str,
app: Any,
*,
base_url: Optional[str] = None,
data_generation_methods: Iterable[DataGenerationMethod] = DEFAULT_DATA_GENERATION_METHODS,
code_sample_style: str = CodeSampleStyle.default().name,
Expand Down

0 comments on commit a2d9beb

Please sign in to comment.