Testing toolbox for blacksmith
Project description
Whitesmith
Test helper for blacksmith resources.
Motivation
While using blacksmith, resources are declared using pydantic, and, while testing, we never do http calls.
Whitesmith is a helper that create pytest fixtures for blacksmith resources and generate handlers for tests.
Usage
Generating fixtures
whitesmith generate -m my_package.resources --out-dir tests/
The commande above will generate a folder tests/whitesmith containing
handlers for all the api call with a default implementation.
Note If you run the command again, the command does not overrite generated files. To generate newer version, use the
--overwriteflag.
Those fixtures can be adapted to get the result you want, they must be present in a whitesmith_handlers directory inside the tests suite.
Using the fixtures
The whitesmith package provide three pytest fixtures that can be used in the testsuite.
The sync_blacksmith_client, async_blacksmith_client can be used to get a blacksmith client instance that use the installed fixtures from the generated directory.
Both actually consume the undelying fixtures whitesmith_router is a generated
fixture that contains all the routes contained in the whitesmith_handlers directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whitesmith-5.2.2.tar.gz.
File metadata
- Download URL: whitesmith-5.2.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.6 CPython/3.13.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8295183bed0929d10fb469a301f9b9128352c0a2f0826dfd823854bb53496e2b
|
|
| MD5 |
ffc1bea033ce706e3dc0b6dfd99ce0df
|
|
| BLAKE2b-256 |
39ae6217a7d7d4abcba811a63bd8ad5afd9a1550a55cc9228ae3266590c9c144
|
File details
Details for the file whitesmith-5.2.2-py3-none-any.whl.
File metadata
- Download URL: whitesmith-5.2.2-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.26.6 CPython/3.13.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fd25007d0a96870c85cdd33522a47d22f5967980506ff1648f801540b3fddeb
|
|
| MD5 |
6bbc0548be578d2e5106a77046030182
|
|
| BLAKE2b-256 |
a9a6e67655b581d895c1d8d842683814f6b3ce65366dd6c45a87e4ae590796c7
|